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