lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Robert G. Jakabosky wrote:
> Attached is a new patch.  This version only saves/restores 8 registers each 
> context switch.  In order to pass the "lua_State *L" parameter 
> to 'coco_main', a wrapper function written in assembly is used to pre-fill 
> rdi before jumping to 'coco_main'.

Thank you -- works fine under Linux. I'd like to add this to the
next Coco release. But it'll break on Mac OS X in 64 bit mode,
since the assembler syntax is different.

I hope this works (but I can't test it):

__asm__ (
#ifdef __MACH__
"\t.private_extern _coco_wrap_main\n"
".local coco_wrap_main\n"
"\t.type coco_wrap_main, @function\n"
"\tmovq %r12, %rax\n"
"\tmovq %r13, %rdi\n"
"\tjmpq *%rax\n"