Anton Korobeynikov | 9ac72c4 | 2008-03-23 14:53:18 +0000 | [diff] [blame^] | 1 | ;;===-- X86CompilationCallback_Win64.asm - Implement Win64 JIT callback ---=== |
| 2 | ;; |
| 3 | ;; The LLVM Compiler Infrastructure |
| 4 | ;; |
| 5 | ;; This file is distributed under the University of Illinois Open Source |
| 6 | ;; License. See LICENSE.TXT for details. |
| 7 | ;; |
| 8 | ;;===----------------------------------------------------------------------=== |
| 9 | ;; |
| 10 | ;; This file implements the JIT interfaces for the X86 target. |
| 11 | ;; |
| 12 | ;;===----------------------------------------------------------------------=== |
| 13 | |
Anton Korobeynikov | 5f287b9 | 2008-03-23 14:44:32 +0000 | [diff] [blame] | 14 | extrn X86CompilationCallback2: PROC |
| 15 | |
| 16 | .code |
| 17 | X86CompilationCallback proc |
| 18 | push rbp |
| 19 | |
| 20 | ; Save RSP |
| 21 | mov rbp, rsp |
| 22 | |
| 23 | ; Save all int arg registers |
| 24 | push rcx |
| 25 | push rdx |
| 26 | push r8 |
| 27 | push r9 |
| 28 | |
| 29 | ; Align stack on 16-byte boundary. |
| 30 | and rsp, -16 |
| 31 | |
| 32 | ; Save all XMM arg registers |
| 33 | sub rsp, 64 |
| 34 | movaps [rsp], xmm0 |
| 35 | movaps [rsp+16], xmm1 |
| 36 | movaps [rsp+32], xmm2 |
| 37 | movaps [rsp+48], xmm3 |
| 38 | |
| 39 | ; JIT callee |
| 40 | |
| 41 | ; Pass prev frame and return address |
| 42 | mov rcx, rbp |
| 43 | mov rdx, qword ptr [rbp+8] |
| 44 | call X86CompilationCallback2 |
| 45 | |
| 46 | ; Restore all XMM arg registers |
| 47 | movaps xmm3, [rsp+48] |
| 48 | movaps xmm2, [rsp+32] |
| 49 | movaps xmm1, [rsp+16] |
| 50 | movaps xmm0, [rsp] |
| 51 | |
| 52 | ; Restore RSP |
| 53 | mov rsp, rbp |
| 54 | |
| 55 | ; Restore all int arg registers |
| 56 | sub rsp, 32 |
| 57 | pop r9 |
| 58 | pop r8 |
| 59 | pop rdx |
| 60 | pop rcx |
| 61 | |
| 62 | ; Restore RBP |
| 63 | pop rbp |
| 64 | ret |
| 65 | X86CompilationCallback endp |
| 66 | |
| 67 | End |