e624dcac146def244b4fde211a398c58b5a6ca44
[cacao.git] / src / vm / jit / x86_64 / md-asm.h
1 /* src/vm/jit/x86_64/md-asm.h - assembler defines for x86_64 Linux ABI
2
3    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Contact: cacao@cacaojvm.org
26
27    Authors: Christian Thalinger
28
29    Changes:
30
31    $Id: md-asm.h 4805 2006-04-21 10:54:24Z twisti $
32
33 */
34
35
36 #ifndef _MD_ASM_H
37 #define _MD_ASM_H
38
39 /* register defines ***********************************************************/
40
41 #define v0       %rax
42 #define v0l      %eax
43 #define itmp1    v0
44
45 #define a3       %rcx
46 #define a2       %rdx
47
48 #define t0       %rbx
49 #define t0l      %ebx
50
51 #define sp       %rsp
52 #define s0       %rbp
53
54 #define a1       %rsi
55 #define a0       %rdi
56 #define a0l      %edi
57
58 #define a4       %r8
59 #define a5       %r9
60
61 #define itmp2    %r10
62 #define itmp3    %r11
63
64 #define s1       %r12
65 #define s2       %r13
66 #define s3       %r14
67 #define s4       %r15
68
69
70 #define bp       s0
71
72 #define itmp1l   %eax
73 #define itmp2l   %r10d
74 #define itmp3l   %r11d
75
76 #define xptr     itmp1
77 #define xpc      itmp2
78 #define mptr     itmp2
79
80
81 #define fa0      %xmm0
82 #define fa1      %xmm1
83 #define fa2      %xmm2
84 #define fa3      %xmm3
85 #define fa4      %xmm4
86 #define fa5      %xmm5
87 #define fa6      %xmm6
88 #define fa7      %xmm7
89
90 #define ftmp1    %xmm8
91 #define ftmp2    %xmm9
92 #define ftmp3    %xmm10
93
94 #define ft0      %xmm11
95 #define ft1      %xmm12
96 #define ft2      %xmm13
97 #define ft3      %xmm14
98 #define ft4      %xmm15
99
100
101 /* save and restore macros ****************************************************/
102
103 #define SAVE_ARGUMENT_REGISTERS(off) \
104         mov     a0,(0+(off))*8(sp)   ; \
105         mov     a1,(1+(off))*8(sp)   ; \
106         mov     a2,(2+(off))*8(sp)   ; \
107         mov     a3,(3+(off))*8(sp)   ; \
108         mov     a4,(4+(off))*8(sp)   ; \
109         mov     a5,(5+(off))*8(sp)   ; \
110         \
111         movq    fa0,(6+(off))*8(sp)  ; \
112         movq    fa1,(7+(off))*8(sp)  ; \
113         movq    fa2,(8+(off))*8(sp)  ; \
114         movq    fa3,(9+(off))*8(sp)  ; \
115         movq    fa4,(10+(off))*8(sp) ; \
116         movq    fa5,(11+(off))*8(sp) ; \
117         movq    fa6,(12+(off))*8(sp) ; \
118         movq    fa7,(13+(off))*8(sp) ;
119
120
121 #define RESTORE_ARGUMENT_REGISTERS(off) \
122         mov     (0+(off))*8(sp),a0   ; \
123         mov     (1+(off))*8(sp),a1   ; \
124         mov     (2+(off))*8(sp),a2   ; \
125         mov     (3+(off))*8(sp),a3   ; \
126         mov     (4+(off))*8(sp),a4   ; \
127         mov     (5+(off))*8(sp),a5   ; \
128         \
129         movq    (6+(off))*8(sp),fa0  ; \
130         movq    (7+(off))*8(sp),fa1  ; \
131         movq    (8+(off))*8(sp),fa2  ; \
132         movq    (9+(off))*8(sp),fa3  ; \
133         movq    (10+(off))*8(sp),fa4 ; \
134         movq    (11+(off))*8(sp),fa5 ; \
135         movq    (12+(off))*8(sp),fa6 ; \
136         movq    (13+(off))*8(sp),fa7 ;
137
138
139 #define SAVE_TEMPORARY_REGISTERS(off) \
140         mov     t0,(0+(off))*8(sp)   ; \
141         movq    ft0,(1+(off))*8(sp)  ; \
142         movq    ft1,(2+(off))*8(sp)  ; \
143         movq    ft2,(3+(off))*8(sp)  ; \
144         movq    ft3,(4+(off))*8(sp)  ;
145
146
147 #define RESTORE_TEMPORARY_REGISTERS(off) \
148         mov     (0+(off))*8(sp),t0   ; \
149         movq    (1+(off))*8(sp),ft0  ; \
150         movq    (2+(off))*8(sp),ft1  ; \
151         movq    (3+(off))*8(sp),ft2  ; \
152         movq    (4+(off))*8(sp),ft3  ;
153
154 #endif /* _MD_ASM_H */
155
156
157 /*
158  * These are local overrides for various environment variables in Emacs.
159  * Please do not remove this and leave it at the end of the file, where
160  * Emacs will automagically detect them.
161  * ---------------------------------------------------------------------
162  * Local variables:
163  * mode: c
164  * indent-tabs-mode: t
165  * c-basic-offset: 4
166  * tab-width: 4
167  * End:
168  */