CACAO
md-abi.hpp
Go to the documentation of this file.
1 /* src/vm/jit/sparc64/md-abi.hpp - defines for Sparc 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  Contact: cacao@cacaojvm.org
24 
25  Authors: Alexander Jordan
26 
27  Changes:
28 
29 */
30 
31 #ifndef MD_ABI_HPP_
32 #define MD_ABI_HPP_ 1
33 
34 /* preallocated registers *****************************************************/
35 
36 /* integer registers */
37 
38 #define REG_RESULT_CALLEE 24 /* to deliver method results */
39 #define REG_RESULT_CALLER 8 /* to read method results */
40 
41 #define REG_RA_CALLEE 31 /* callee reads return address here */
42 #define REG_RA_CALLER 15 /* caller puts address of call instr here */
43 
44 #define REG_PV_CALLEE 29 /* procedure vector, as found by callee */
45 #define REG_PV_CALLER 13 /* caller provides PV here */
46 
47 
48 #define REG_METHODPTR 2 /* pointer to the place from where the procedure */
49  /* vector has been fetched */
50 
51 
52 #define REG_ITMP1 1 /* temporary register (scratch) */
53 #define REG_ITMP2 2 /* temporary register (application) */
54 #define REG_ITMP3 3 /* temporary register (application) */
55 
56 #define REG_ITMP2_XPTR 2 /* exception pointer = temporary register 2 */
57 #define REG_ITMP3_XPC 3 /* exception pc = temporary register 3 */
58 
59 #define REG_SP 14 /* stack pointer */
60 #define REG_FP 30 /* frame pointer */
61 #define REG_ZERO 0 /* always zero */
62 
63 #define REG_OUT0 8 /* define some argument registers */
64 #define REG_OUT1 9
65 #define REG_OUT2 10
66 #define REG_OUT3 11
67 #define REG_OUT4 12
68 #define REG_OUT5 13 /* available only when doing a C-call */
69 
70 /* floating point registers */
71 /* only using the lower half of the floating registers for now */
72 
73 
74 #define REG_FRESULT 0 /* to deliver floating point method results */
75 
76 #define REG_FTMP1 1 /* temporary floating point register */
77 #define REG_FTMP2 2 /* temporary floating point register */
78 #define REG_FTMP3 3 /* temporary floating point register */
79 
80 #define REG_IFTMP 1 /* temporary integer and floating point register */
81 
82 #define REG_F0 0
83 
84 
85 #define INT_REG_CNT 32 /* number of integer registers */
86 #define INT_SAV_CNT 13 /* number of int callee saved registers */
87 #define INT_ARG_CNT 5 /* number of int argument registers (-1 for PV) */
88 #define INT_TMP_CNT 0 /* int temp registers (%g4-%g5) */
89 #define INT_RES_CNT 14 /* number of reserved integer registers */
90  /* pv, zero, %g6, %g7, sp, ra */
91 
92 #define FLT_REG_CNT 16 /* number of float registers */
93 #define FLT_SAV_CNT 0 /* number of flt callee saved registers */
94 #define FLT_ARG_CNT 5 /* number of flt argument registers */
95 #define FLT_TMP_CNT 7 /* number of flt temp registers */
96 #define FLT_RES_CNT 3 /* number of reserved float registers */
97  /* the one "missing" register is the return reg */
98 
99 /* different argument counts when following the ABI for native functions */
100 #define INT_NATARG_CNT 6
101 #define FLT_NATARG_CNT 16
102 
103 #define TRACE_ARGS_NUM 6
104 
105 /* helpers for stack addressing and window handling */
106 
107 #define BIAS 2047 /* SPARC V9: stack @ address SP + BIAS */
108 
109 /* SPARC ABI always wants argument slots on the stack, even when not used */
110 
111 #define WINSAVE_CNT 16 /* number of regs that SPARC saves onto stack */
112 #define ABIPARAMS_CNT 6 /* param slots the ABI always requires on stack */
113 
114 #define JITSTACK_CNT (WINSAVE_CNT + ABIPARAMS_CNT)
115 #define CSTACK_CNT (WINSAVE_CNT + ABIPARAMS_CNT)
116 
117 #define JITSTACK ((JITSTACK_CNT) * 8 + BIAS)
118 #define CSTACK ((CSTACK_CNT) * 8 + BIAS)
119 
120 
121 
122 /* applies when the caller's window was saved */
123 #define REG_WINDOW_TRANSPOSE(reg) \
124  (reg + 16)
125 
126 #endif // MD_ABI_HPP_
127 
128 
129 /*
130  * These are local overrides for various environment variables in Emacs.
131  * Please do not remove this and leave it at the end of the file, where
132  * Emacs will automagically detect them.
133  * ---------------------------------------------------------------------
134  * Local variables:
135  * mode: c++
136  * indent-tabs-mode: t
137  * c-basic-offset: 4
138  * tab-width: 4
139  * End:
140  * vim:noexpandtab:sw=4:ts=4:
141  */