1 #ifndef __ASM_SH64_REGISTERS_H
2 #define __ASM_SH64_REGISTERS_H
3 
4 /*
5  * This file is subject to the terms and conditions of the GNU General Public
6  * License.  See the file "COPYING" in the main directory of this archive
7  * for more details.
8  *
9  * include/asm-sh64/registers.h
10  *
11  * Copyright (C) 2000, 2001  Paolo Alberelli
12  *
13  */
14 
15 #ifdef __ASSEMBLY__
16 /* =====================================================================
17 **
18 ** Section 1: acts on assembly sources pre-processed by GPP ( <source.S>).
19 **	      Assigns symbolic names to control & target registers.
20 */
21 
22 /*
23  * Concerning registers name, the assembly sources follows the
24  * CDC naming convention.
25  * This section converts CDC registers names into RedHat style.
26  */
27 
28 /*
29  * Control Registers.
30  */
31 #define SR	cr0
32 #define SSR	cr1
33 #define PSSR	cr2
34 			/* cr3 UNDEFINED */
35 #define INTEVT	cr4
36 #define EXPEVT	cr5
37 #define PEXPEVT	cr6
38 #define TRA	cr7
39 #define SPC	cr8
40 #define PSPC	cr9
41 #define RESVEC	cr10
42 #define VBR	cr11
43 			/* cr12 UNDEFINED */
44 #define TEA	cr13
45 			/* cr14-cr15 UNDEFINED */
46 #define DCR	cr16
47 #define KCR0	cr17
48 #define KCR1	cr18
49 			/* cr19-cr31 UNDEFINED */
50 			/* cr32-cr61 RESERVED */
51 #define CTC	cr62
52 #define USR	cr63
53 
54 /*
55  * ABI dependent registers (general purpose set)
56  * Note: this set of registers name could be shared by the
57  *       CDC and RedHat toolchain
58  */
59 #define RET	r2
60 #define ARG1	r2
61 #define ARG2	r3
62 #define ARG3	r4
63 #define ARG4	r5
64 #define ARG5	r6
65 #define ARG6	r7
66 #define FBP	r14
67 #define SP	r15
68 #define GVDT	r26
69 #define GCDT	r27
70 #define LINK	r18
71 #define OS	r40
72 #define ZERO	r63
73 
74 /*
75  * Target registers need name convertion...
76  * (defines only those used by assembly code)
77  */
78 #define t0	tr0
79 #define t1	tr1
80 #define t2	tr2
81 #define t3	tr3
82 #define t4	tr4
83 #define t5	tr5
84 #define t6	tr6
85 #define t7	tr7
86 
87 /*
88 ** RedHat style compatibility macros:
89 **
90 **   _loada: loads the address the address  of the symbol (first
91 **           argument) into the general purpose register (second
92 **           argument)
93 */
94         .macro  _loada   symbol, gp_reg
95          movi   \symbol, \gp_reg
96         .endm
97 
98         .macro  _ptar    symbol, tr_reg
99          pt     \symbol, \tr_reg
100         .endm
101 
102         .macro  _ptaru   symbol, tr_reg
103          pt/u   \symbol, \tr_reg
104         .endm
105 
106         .macro  _pta    disp_b,  tr_reg
107          pta    $+\disp_b, \tr_reg
108         .endm
109 
110 /*
111  * Status register defines: used only by assembly sources (and
112  * 			    syntax independednt)
113  */
114 #define SR_RESET_VAL	0x0000000050008000
115 #define SR_HARMLESS	0x00000000500080f0	/* Write ignores for most */
116 #define SR_ENABLE_FPU	0xffffffffffff7fff	/* AND with this */
117 
118 #if defined (CONFIG_SH64_SR_WATCH)
119 #define SR_ENABLE_MMU	0x0000000084000000	/* OR with this */
120 #else
121 #define SR_ENABLE_MMU	0x0000000080000000	/* OR with this */
122 #endif
123 
124 #define SR_UNBLOCK_EXC	0xffffffffefffffff	/* AND with this */
125 #define SR_BLOCK_EXC	0x0000000010000000	/* OR with this */
126 
127 #else	/* Not __ASSEMBLY__ syntax */
128 
129 /* =====================================================================
130 **
131 ** Section 2: this is required to manage __asm__ statement expanded
132 **            by "C" compiler
133 */
134 	/*
135 	** RedHat style symbolic address resolution inside "asm" blocks
136 	*/
137         asm ("\t.macro  _loada   symbol, gp_reg\n"
138              "\tmovi    \\symbol, \\gp_reg\n"
139              "\t.endm\n"
140              "\n"
141              "\t.macro  _ptar    symbol, tr_reg\n"
142              "\tpt      \\symbol, \\tr_reg\n"
143              "\t.endm\n"
144              "\n"
145              "\t.macro  _pta    disp_b, tr_reg\n"
146              "\tpta     $+\\disp_b, \\tr_reg\n"
147              "\t.endm\n"
148 	     "\n"
149              "\t.macro  _fgetscr  f_reg63\n"
150 	     "\tfgetscr \\f_reg63\n"
151              "\t.endm\n"
152 	     "\n"
153              "\t.macro  _fputscr  f_reg63\n"
154 	     "\tfputscr \\f_reg63\n"
155              "\t.endm\n"
156 	     "\n"
157 	    );
158 
159 	/*
160 	** RedHat style target register name inside "asm" blocks
161 	*/
162 #	define __t0	__str(tr0)
163 #	define __t1	__str(tr1)
164 #	define __t2	__str(tr2)
165 #	define __t3	__str(tr3)
166 #	define __t4	__str(tr4)
167 #	define __t5	__str(tr5)
168 #	define __t6	__str(tr6)
169 #	define __t7	__str(tr7)
170 
171 	/*
172 	** RedHat style control register name inside "asm" blocks
173 	*/
174 #	define __c0	__str(cr0)		/* SR       */
175 #	define __c1	__str(cr1)		/* SSR      */
176 #	define __c2	__str(cr2)		/* PSSR     */
177 #	define __c4	__str(cr4)		/* INTEVT   */
178 #	define __c5	__str(cr5)		/* EXPEVT   */
179 #	define __c6	__str(cr6)		/* PEXPEVT  */
180 #	define __c8	__str(cr8)		/* SPC      */
181 #	define __c9	__str(cr9)		/* PSPC     */
182 #	define __c13	__str(cr13)		/* TEA      */
183 #	define __c17	__str(cr17)		/* KCR0     */
184 #	define __c18	__str(cr18)		/* KCR1     */
185 
186 	/*
187 	** RedHat style float and double register name inside "asm" blocks
188 	** defines below are used only in .../arch/sh5/kernel/fpu.c
189 	*/
190 #	define __f(x)	__str(fr##x)
191 #	define __p(x)	__str(fp##x)
192 #	define __d(x)	__str(dr##x)
193 
194 	/*
195 	** Stringify reg. name (common for CDC & RedHat)
196 	*/
197 #	define __str(x)  #x
198 
199 #endif /* __ASSEMBLY__ */
200 #endif /* __ASM_SH64_REGISTERS_H */
201