Re: inline assembly
Re: inline assembly
- Subject: Re: inline assembly
- From: Andrew Pinski <email@hidden>
- Date: Wed, 25 Feb 2004 00:04:55 -0800
On Feb 24, 2004, at 15:15, Shaun Wexler wrote:
How do I call a stub function **** within my ObjC inline assembly
block? I've scoured online docs, and found the jbsr macro, but I
can't figure out how to implement it. Also, I would actually like to
mtlr 1: and jmp instead of the bl and subsequent b, if that's
feasible. How? (PPCasm-newbie Q's)...
asm volatile (
"1: li %[c], 1\n"
"2: lwarx %[s], 0, %[p]\n"
" cmpwi %[s], 0\n"
" beq+ 3f\n"
" jbsr ****,****\n" // sched_yield();
" b 1b\n"
"3: stwcx. %[c], 0, %[p]\n"
" bne- 2b\n"
" isync \n"
: [c] "=&r" (c), [s] "=&r" (s)
: [p] "r" (p)
: "cc" );
TIA for help. ;)
Try this instead (aka do not use inline-asm except when needed, also you
should not be calling extern functions from within inline-asm at all, it
messes up GCC optimizations):
while (1)
{
while (*p != 0)
sched_yield();
c = 1;
asm volatile (
" lwarx %[s], 0, %[p]\n"
" cmpwi %[s], 0\n"
" bne+ 1f\n"
" stwcx. %[c], 0, %[p]\n"
" bne- 1f\n"
" isync \n"
" b 2f\n"
"1: \n"
" li %[c], 0\n"
"2: \n"
: [c] "+r" (c), [s] "=&r" (s)
: [p] "r" (p)
: "cc" );
if (c == 1)
break;
}
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.