David Leimbach wrote:
Actually, this code violates the ABI. The stack needs to be aligned
on a 16byte address.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/index.html
So the assembly block should be:
asm(
"pushal\n"
"movl 8(%ebp), %ebx\n"
"movl 12(%ebp), %eax\n"
"xchgl %esp, %eax\n"
"subl $0xc, %esp\n" //need to align the stack... can't just
pushl
"pushl %eax\n"
"call *%ebx\n"
"popl %esp\n"
"popal\n"
);
Just don't compile with -Os because gcc freaking inlines runonstack.
*shrug*
Whom to throttle for that one?
I guess you could tack on a __attribute__ ((noinline))
to the prototype.
(as always, gcc is beeing "nice" enough to provide hacks
that gets you out of the trouble it created for you in the first
place)