blob: a11c5c3ce431305445e06375212870901e4ff77a [file] [log] [blame]
Anton Korobeynikovf8e74162008-03-23 14:53:18 +00001;;===-- 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 Korobeynikov231e9642008-03-23 14:44:32 +000014extrn X86CompilationCallback2: PROC
15
16.code
17X86CompilationCallback proc
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000018 ; Save all int arg registers into register spill area.
19 mov [rsp+ 8], rcx
20 mov [rsp+16], rdx
21 mov [rsp+24], r8
22 mov [rsp+32], r9
23
Anton Korobeynikov231e9642008-03-23 14:44:32 +000024 push rbp
25
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000026 ; Save RSP.
Anton Korobeynikov231e9642008-03-23 14:44:32 +000027 mov rbp, rsp
28
Anton Korobeynikov231e9642008-03-23 14:44:32 +000029 ; Align stack on 16-byte boundary.
30 and rsp, -16
31
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000032 ; Save all XMM arg registers. Also allocate reg spill area.
33 sub rsp, 96
34 movaps [rsp +32], xmm0
35 movaps [rsp+16+32], xmm1
36 movaps [rsp+32+32], xmm2
37 movaps [rsp+48+32], xmm3
Anton Korobeynikov231e9642008-03-23 14:44:32 +000038
39 ; JIT callee
40
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000041 ; Pass prev frame and return address.
Anton Korobeynikov231e9642008-03-23 14:44:32 +000042 mov rcx, rbp
43 mov rdx, qword ptr [rbp+8]
44 call X86CompilationCallback2
45
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000046 ; Restore all XMM arg registers.
47 movaps xmm3, [rsp+48+32]
48 movaps xmm2, [rsp+32+32]
49 movaps xmm1, [rsp+16+32]
50 movaps xmm0, [rsp +32]
Anton Korobeynikov231e9642008-03-23 14:44:32 +000051
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000052 ; Restore RSP.
Anton Korobeynikov231e9642008-03-23 14:44:32 +000053 mov rsp, rbp
54
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000055 ; Restore RBP.
Anton Korobeynikov231e9642008-03-23 14:44:32 +000056 pop rbp
Anton Korobeynikovcf6b7392009-08-03 08:12:53 +000057
58 ; Restore all int arg registers.
59 mov r9, [rsp+32]
60 mov r8, [rsp+24]
61 mov rdx, [rsp+16]
62 mov rcx, [rsp+ 8]
63
Anton Korobeynikov231e9642008-03-23 14:44:32 +000064 ret
65X86CompilationCallback endp
66
67End