1 /* src/vm/jit/x86_64/md-asm.h - assembler defines for x86_64 Linux ABI
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
8 This file is part of CACAO.
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.
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.
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
25 Contact: cacao@cacaojvm.org
27 Authors: Christian Thalinger
31 $Id: md-asm.h 7442 2007-03-02 23:28:37Z pm $
39 /* register defines ***********************************************************/
130 /* save and restore macros ****************************************************/
132 #define SAVE_ARGUMENT_REGISTERS(off) \
133 mov a0,(0+(off))*8(sp) ; \
134 mov a1,(1+(off))*8(sp) ; \
135 mov a2,(2+(off))*8(sp) ; \
136 mov a3,(3+(off))*8(sp) ; \
137 mov a4,(4+(off))*8(sp) ; \
138 mov a5,(5+(off))*8(sp) ; \
140 movq fa0,(6+(off))*8(sp) ; \
141 movq fa1,(7+(off))*8(sp) ; \
142 movq fa2,(8+(off))*8(sp) ; \
143 movq fa3,(9+(off))*8(sp) ; \
144 movq fa4,(10+(off))*8(sp) ; \
145 movq fa5,(11+(off))*8(sp) ; \
146 movq fa6,(12+(off))*8(sp) ; \
147 movq fa7,(13+(off))*8(sp) ;
150 #define RESTORE_ARGUMENT_REGISTERS(off) \
151 mov (0+(off))*8(sp),a0 ; \
152 mov (1+(off))*8(sp),a1 ; \
153 mov (2+(off))*8(sp),a2 ; \
154 mov (3+(off))*8(sp),a3 ; \
155 mov (4+(off))*8(sp),a4 ; \
156 mov (5+(off))*8(sp),a5 ; \
158 movq (6+(off))*8(sp),fa0 ; \
159 movq (7+(off))*8(sp),fa1 ; \
160 movq (8+(off))*8(sp),fa2 ; \
161 movq (9+(off))*8(sp),fa3 ; \
162 movq (10+(off))*8(sp),fa4 ; \
163 movq (11+(off))*8(sp),fa5 ; \
164 movq (12+(off))*8(sp),fa6 ; \
165 movq (13+(off))*8(sp),fa7 ;
168 #define SAVE_TEMPORARY_REGISTERS(off) \
169 mov t0,(0+(off))*8(sp) ; \
170 movq ft0,(1+(off))*8(sp) ; \
171 movq ft1,(2+(off))*8(sp) ; \
172 movq ft2,(3+(off))*8(sp) ; \
173 movq ft3,(4+(off))*8(sp) ;
176 #define RESTORE_TEMPORARY_REGISTERS(off) \
177 mov (0+(off))*8(sp),t0 ; \
178 movq (1+(off))*8(sp),ft0 ; \
179 movq (2+(off))*8(sp),ft1 ; \
180 movq (3+(off))*8(sp),ft2 ; \
181 movq (4+(off))*8(sp),ft3 ;
183 /* Volatile float registers (all volatile in terms of C abi) */
185 #define LOAD_STORE_VOLATILE_FLOAT_REGISTERS(inst, off) \
186 inst %f0, ((0 * 8) + (off))(sp); \
187 inst %f2, ((1 * 8) + (off))(sp); \
188 inst %f1, ((2 * 8) + (off))(sp); \
189 inst %f3, ((3 * 8) + (off))(sp); \
190 inst %f5, ((4 * 8) + (off))(sp); \
191 inst %f7, ((5 * 8) + (off))(sp); \
192 inst %f8, ((6 * 8) + (off))(sp); \
193 inst %f9, ((7 * 8) + (off))(sp); \
194 inst %f10, ((8 * 8) + (off))(sp); \
195 inst %f11, ((9 * 8) + (off))(sp); \
196 inst %f12, ((10 * 8) + (off))(sp); \
197 inst %f13, ((11 * 8) + (off))(sp); \
198 inst %f14, ((12 * 8) + (off))(sp); \
199 inst %f15, ((13 * 8) + (off))(sp);
201 #define VOLATILE_FLOAT_REGISTERS_SIZE (14 * 8)
203 #define LOAD_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(ld, off)
204 #define STORE_VOLATILE_FLOAT_REGISTERS(off) LOAD_STORE_VOLATILE_FLOAT_REGISTERS(std, off)
206 /* Volatile integer registers (all volatile in terms of C abi) */
208 #define LOAD_STORE_VOLATILE_INTEGER_REGISTERS(instm, inst, off) \
209 instm %r0, %r5, ((0 * 4) + (off))(sp); \
210 inst %r14, ((6 * 4) + (off))(sp);
212 #define VOLATILE_INTEGER_REGISTERS_SIZE (7 * 4)
214 #define LOAD_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(lm, l, off)
215 #define STORE_VOLATILE_INTEGER_REGISTERS(off) LOAD_STORE_VOLATILE_INTEGER_REGISTERS(stm, st, off)
217 /* Argument registers (in terms of JAVA an C abi) */
219 #define ARGUMENT_REGISTERS_SIZE ((5 * 4) + (2 * 8))
221 #define LOAD_STORE_ARGUMENT_REGISTERS(iinst, finst, off) \
222 iinst %r2, %r6, (off)(sp) ; \
223 finst %f0, (off + (5 * 4))(sp) ; \
224 finst %f2, (off + (5 * 4) + 8)(sp)
226 #define STORE_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(stm, std, off)
227 #define LOAD_ARGUMENT_REGISTERS(off) LOAD_STORE_ARGUMENT_REGISTERS(lm, ld, off)
229 /* Temporary registers (in terms of JAVA abi) */
231 #define TEMPORARY_REGISTERS_SIZE ((1 * 4) + (12 * 8))
233 #define LOAD_STORE_TEMPORARY_REGISTERS(iinst, finst, off) \
234 finst %f1, ((0 * 8) + (off))(sp); \
235 finst %f3, ((1 * 8) + (off))(sp); \
236 finst %f5, ((2 * 8) + (off))(sp); \
237 finst %f7, ((3 * 8) + (off))(sp); \
238 finst %f8, ((4 * 8) + (off))(sp); \
239 finst %f9, ((5 * 8) + (off))(sp); \
240 finst %f10, ((6 * 8) + (off))(sp); \
241 finst %f11, ((7 * 8) + (off))(sp); \
242 finst %f12, ((8 * 8) + (off))(sp); \
243 finst %f13, ((9 * 8) + (off))(sp); \
244 finst %f14, ((10 * 8) + (off))(sp); \
245 finst %f15, ((11 * 8) + (off))(sp); \
246 iinst %r0, ((12 * 8) + (off))(sp);
248 #define LOAD_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(l, ld, off)
249 #define STORE_TEMPORARY_REGISTERS(off) LOAD_STORE_TEMPORARY_REGISTERS(st, std, off)
251 #endif /* _MD_ASM_H */
255 * These are local overrides for various environment variables in Emacs.
256 * Please do not remove this and leave it at the end of the file, where
257 * Emacs will automagically detect them.
258 * ---------------------------------------------------------------------
261 * indent-tabs-mode: t