ABI stuff.
[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 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    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., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Thalinger
28
29    Changes:
30
31    $Id: md-asm.h 2588 2005-06-08 10:58:04Z twisti $
32
33 */
34
35
36 #ifndef _MD_ASM_H
37 #define _MD_ASM_H
38
39
40 /* register defines ***********************************************************/
41
42 #define v0       %rax
43 #define v0l      %eax
44
45 #define a0       %rdi
46 #define a1       %rsi
47 #define a2       %rdx
48 #define a3       %rcx
49 #define a4       %r8
50 #define a5       %r9
51
52 #define fa0      %xmm0
53 #define fa1      %xmm1
54 #define fa2      %xmm2
55 #define fa3      %xmm3
56 #define fa4      %xmm4
57 #define fa5      %xmm5
58 #define fa6      %xmm6
59 #define fa7      %xmm7
60
61 #define itmp1    %rax
62 #define itmp2    %r10
63 #define itmp3    %r11
64
65 #define itmp1l   %eax
66 #define itmp2l   %r10d
67 #define itmp3l   %r11d
68
69 #define itmp1b   %al
70 #define itmp2b   %r10b
71 #define itmp3b   %r11b
72
73 #define xptr     itmp1
74 #define xpc      itmp2
75
76
77 /* save and restore macros ****************************************************/
78
79 #define SAVE_ARGUMENT_REGISTERS(off) \
80         mov     a0,(0+(off))*8(%rsp)            ; \
81         mov     a1,(1+(off))*8(%rsp)            ; \
82         mov     a2,(2+(off))*8(%rsp)            ; \
83         mov     a3,(3+(off))*8(%rsp)            ; \
84         mov     a4,(4+(off))*8(%rsp)            ; \
85         mov     a5,(5+(off))*8(%rsp)            ; \
86         \
87         movq    fa0,(6+(off))*8(%rsp)           ; \
88         movq    fa1,(7+(off))*8(%rsp)           ; \
89         movq    fa2,(8+(off))*8(%rsp)           ; \
90         movq    fa3,(9+(off))*8(%rsp)           ; \
91         movq    fa4,(10+(off))*8(%rsp)          ; \
92         movq    fa5,(11+(off))*8(%rsp)          ; \
93         movq    fa6,(12+(off))*8(%rsp)          ; \
94         movq    fa7,(13+(off))*8(%rsp)          ;
95
96
97 #define RESTORE_ARGUMENT_REGISTERS(off) \
98         mov     (0+(off))*8(%rsp),a0            ; \
99         mov     (1+(off))*8(%rsp),a1            ; \
100         mov     (2+(off))*8(%rsp),a2            ; \
101         mov     (3+(off))*8(%rsp),a3            ; \
102         mov     (4+(off))*8(%rsp),a4            ; \
103         mov     (5+(off))*8(%rsp),a5            ; \
104         \
105         movq    (6+(off))*8(%rsp),fa0           ; \
106         movq    (7+(off))*8(%rsp),fa1           ; \
107         movq    (8+(off))*8(%rsp),fa2           ; \
108         movq    (9+(off))*8(%rsp),fa3           ; \
109         movq    (10+(off))*8(%rsp),fa4          ; \
110         movq    (11+(off))*8(%rsp),fa5          ; \
111         movq    (12+(off))*8(%rsp),fa6          ; \
112         movq    (13+(off))*8(%rsp),fa7          ; 
113
114
115 #define SAVE_TEMPORARY_REGISTERS(off) \
116         mov     %rbx,(0+(off))*8(%rsp)
117
118
119 #define RESTORE_TEMPORARY_REGISTERS(off) \
120         mov     (0+(off))*8(%rsp),%rbx
121
122 #endif /* _MD_ASM_H */
123
124
125 /*
126  * These are local overrides for various environment variables in Emacs.
127  * Please do not remove this and leave it at the end of the file, where
128  * Emacs will automagically detect them.
129  * ---------------------------------------------------------------------
130  * Local variables:
131  * mode: c
132  * indent-tabs-mode: t
133  * c-basic-offset: 4
134  * tab-width: 4
135  * End:
136  */