mirror of
https://git.suyu.dev/suyu/Yucom.git
synced 2026-01-08 07:27:58 +01:00
vrclient: Fix x64 thunks for C API.
* Clean up the stack properly. * Do not push parameters after shadow register space.
This commit is contained in:
parent
5c4e0ab079
commit
23ffdc5ec8
20 changed files with 2438 additions and 2382 deletions
|
|
@ -919,13 +919,44 @@ __ASM_GLOBAL_FUNC(call_flat_method,
|
|||
"pushl %eax\n\t"
|
||||
"jmp *%edx");
|
||||
#else
|
||||
__ASM_GLOBAL_FUNC(call_flat_method,
|
||||
"popq %rax\n\t" // return address
|
||||
"pushq %r9\n\t"
|
||||
"pushq %rax\n\t"
|
||||
// handles "this" and up to 3 parameters
|
||||
__ASM_GLOBAL_FUNC(call_flat_method3,
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"jmp *%r11");
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method4,
|
||||
"subq $0x28, %rsp\n\t" // shadow register space and 1 parameter
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x28, %rsp\n\t"
|
||||
"ret");
|
||||
|
||||
// handles "this" and up to 9 parameters
|
||||
__ASM_GLOBAL_FUNC(call_flat_method9,
|
||||
"subq $0x58, %rsp\n\t" // shadow register space and 6 parameters
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq 0x80(%rsp), %rax\n\t" // copy parameters
|
||||
"movq %rax, 0x28(%rsp)\n\t"
|
||||
"movq 0x88(%rsp), %rax\n\t"
|
||||
"movq %rax, 0x30(%rsp)\n\t"
|
||||
"movq 0x90(%rsp), %rax\n\t"
|
||||
"movq %rax, 0x38(%rsp)\n\t"
|
||||
"movq 0x98(%rsp), %rax\n\t"
|
||||
"movq %rax, 0x40(%rsp)\n\t"
|
||||
"movq 0xa0(%rsp), %rax\n\t"
|
||||
"movq %rax, 0x48(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x58, %rsp\n\t"
|
||||
"ret");
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue