diff options
Diffstat (limited to 'src/vm/amd64/unixasmhelpers.S')
-rw-r--r-- | src/vm/amd64/unixasmhelpers.S | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/vm/amd64/unixasmhelpers.S b/src/vm/amd64/unixasmhelpers.S index 21a8f63232..058a69a382 100644 --- a/src/vm/amd64/unixasmhelpers.S +++ b/src/vm/amd64/unixasmhelpers.S @@ -184,12 +184,13 @@ NESTED_ENTRY OnHijackScalarTripThread, _TEXT, NoHandler PUSH_CALLEE_SAVED_REGISTERS + push_register rdx // Push rax again - this is where integer/pointer return values are returned push_register rax mov rdi, rsp - alloc_stack 0x20 + alloc_stack 0x28 // First float return register movdqa [rsp], xmm0 @@ -202,14 +203,55 @@ NESTED_ENTRY OnHijackScalarTripThread, _TEXT, NoHandler movdqa xmm0, [rsp] movdqa xmm1, [rsp+0x10] - free_stack 0x20 + free_stack 0x28 pop_register rax + pop_register rdx POP_CALLEE_SAVED_REGISTERS ret NESTED_END OnHijackScalarTripThread, _TEXT +#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING +//------------------------------------------------ +// OnHijackStructInRegsTripThread +// +NESTED_ENTRY OnHijackStructInRegsTripThread, _TEXT, NoHandler + + // Make room for the real return address (rip) + push_register rax + + PUSH_CALLEE_SAVED_REGISTERS + + push_register rdx + // Push rax again - this is where part of the struct gets returned + push_register rax + + mov rdi, rsp + + alloc_stack 0x28 + + // First float return register + movdqa [rsp], xmm0 + // Second float return register + movdqa [rsp+0x10], xmm1 + + END_PROLOGUE + + call C_FUNC(OnHijackStructInRegsWorker) + + movdqa xmm0, [rsp] + movdqa xmm1, [rsp+0x10] + free_stack 0x28 + pop_register rax + pop_register rdx + + POP_CALLEE_SAVED_REGISTERS + ret + +NESTED_END OnHijackStructInRegsTripThread, _TEXT +#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING + //------------------------------------------------ // OnHijackObjectTripThread // @@ -220,16 +262,22 @@ NESTED_ENTRY OnHijackObjectTripThread, _TEXT, NoHandler PUSH_CALLEE_SAVED_REGISTERS + push_register rdx // Push rax again - this is where integer/pointer return values are returned push_register rax mov rdi, rsp + // align stack + alloc_stack 0x8 + END_PROLOGUE call C_FUNC(OnHijackObjectWorker) + free_stack 0x8 pop_register rax + pop_register rdx POP_CALLEE_SAVED_REGISTERS ret @@ -246,16 +294,22 @@ NESTED_ENTRY OnHijackInteriorPointerTripThread, _TEXT, NoHandler PUSH_CALLEE_SAVED_REGISTERS + push_register rdx // Push rax again - this is where integer/pointer return values are returned push_register rax mov rdi, rsp + // align stack + alloc_stack 0x8 + END_PROLOGUE call C_FUNC(OnHijackInteriorPointerWorker) + free_stack 0x8 pop_register rax + pop_register rdx POP_CALLEE_SAVED_REGISTERS ret |