> 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. 
> Whom to throttle for that one?

The real version doesn't use inline assembly, so it's not a problem.
I just wanted a single file demonstrating the problem.

After aligning the stack pointer properly, the x86 OS X code
now in CVS does appear to work.

Thanks very much for tracking this down.

Russ

Reply via email to