[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] llvm-lua 0.2
- From: Mike Pall <mikelu-0808@...>
- Date: Sun, 31 Aug 2008 23:58:23 +0200
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__ (
"\t.text\n"
#ifdef __MACH__
"\t.private_extern _coco_wrap_main\n"
"_coco_wrap_main:\n"
#else
".local coco_wrap_main\n"
"\t.type coco_wrap_main, @function\n"
"coco_wrap_main:\n"
#endif
"\tmovq %r12, %rax\n"
"\tmovq %r13, %rdi\n"
"\tjmpq *%rax\n"
);
--Mike