root / target-ppc / op.tpl @ 79aceca5
History | View | Annotate | Download (3 kB)
1 |
/* |
---|---|
2 |
* PPC emulation micro-operations for qemu. |
3 |
* |
4 |
* Copyright (c) 2003 Jocelyn Mayer |
5 |
* |
6 |
* This library is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public |
8 |
* License as published by the Free Software Foundation; either |
9 |
* version 2 of the License, or (at your option) any later version. |
10 |
* |
11 |
* This library is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
* Lesser General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU Lesser General Public |
17 |
* License along with this library; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
/* Host registers definitions */ |
22 |
$DEFH T 3 |
23 |
/* PPC registers definitions */ |
24 |
$DEF gpr 32 |
25 |
$DEF fpr 32 |
26 |
$DEF crf 8 |
27 |
$DEF spr 1024 |
28 |
|
29 |
/* PPC registers <-> host registers move */ |
30 |
/* GPR */ |
31 |
$OP load_gpr_T0 gpr |
32 |
{ |
33 |
T0 = regs->gpra; |
34 |
RETURN(); |
35 |
} |
36 |
$ENDOP |
37 |
|
38 |
$OP load_gpr_T1 gpr |
39 |
{ |
40 |
T1 = regs->gpra; |
41 |
RETURN(); |
42 |
} |
43 |
$ENDOP |
44 |
|
45 |
$OP load_gpr_T2 gpr |
46 |
{ |
47 |
T2 = regs->gpra; |
48 |
RETURN(); |
49 |
} |
50 |
$ENDOP |
51 |
|
52 |
$OP store_T0_gpr gpr |
53 |
{ |
54 |
regs->gpra = T0; |
55 |
RETURN(); |
56 |
} |
57 |
$ENDOP |
58 |
|
59 |
$OP store_T1_gpr gpr |
60 |
{ |
61 |
regs->gpra = T1; |
62 |
RETURN(); |
63 |
} |
64 |
$ENDOP |
65 |
|
66 |
$OP store_gpr_P gpr PARAM |
67 |
{ |
68 |
regs->gpra = PARAM(1); |
69 |
RETURN(); |
70 |
} |
71 |
$ENDOP |
72 |
|
73 |
/* crf */ |
74 |
$OP load_crf_T0 crf |
75 |
{ |
76 |
T0 = regs->crfa; |
77 |
RETURN(); |
78 |
} |
79 |
$ENDOP |
80 |
|
81 |
$OP load_crf_T1 crf |
82 |
{ |
83 |
T1 = regs->crfa; |
84 |
RETURN(); |
85 |
} |
86 |
$ENDOP |
87 |
|
88 |
$OP store_T0_crf crf |
89 |
{ |
90 |
regs->crfa = T0; |
91 |
RETURN(); |
92 |
} |
93 |
$ENDOP |
94 |
|
95 |
$OP store_T1_crf crf |
96 |
{ |
97 |
regs->crfa = T1; |
98 |
RETURN(); |
99 |
} |
100 |
$ENDOP |
101 |
|
102 |
/* SPR */ |
103 |
$OP load_spr spr |
104 |
{ |
105 |
T0 = regs->spra; |
106 |
RETURN(); |
107 |
} |
108 |
$ENDOP |
109 |
|
110 |
$OP store_spr spr |
111 |
{ |
112 |
regs->spra = T0; |
113 |
RETURN(); |
114 |
} |
115 |
$ENDOP |
116 |
|
117 |
/* FPSCR */ |
118 |
$OP load_fpscr fpr |
119 |
{ |
120 |
regs->fpra = do_load_fpscr(); |
121 |
RETURN(); |
122 |
} |
123 |
$ENDOP |
124 |
|
125 |
$OP store_fpscr fpr PARAM |
126 |
{ |
127 |
do_store_fpscr(PARAM(1), regs->fpra); |
128 |
RETURN(); |
129 |
} |
130 |
$ENDOP |
131 |
|
132 |
/*** Floating-point store ***/ |
133 |
/* candidate for helper (too long on x86 host) */ |
134 |
$OP stfd_z fpr PARAM |
135 |
{ |
136 |
st64(SPARAM(1), regs->fpra); |
137 |
RETURN(); |
138 |
} |
139 |
$ENDOP |
140 |
|
141 |
/* candidate for helper (too long on x86 host) */ |
142 |
$OP stfd fpr PARAM |
143 |
{ |
144 |
T0 += SPARAM(1); |
145 |
st64(T0, regs->fpra); |
146 |
RETURN(); |
147 |
} |
148 |
$ENDOP |
149 |
|
150 |
/* candidate for helper (too long on x86 host) */ |
151 |
$OP stfdx_z fpr |
152 |
{ |
153 |
st64(T0, regs->fpra); |
154 |
RETURN(); |
155 |
} |
156 |
$ENDOP |
157 |
/* candidate for helper (too long on x86 host) */ |
158 |
$OP stfdx fpr |
159 |
{ |
160 |
T0 += T1; |
161 |
st64(T0, regs->fpra); |
162 |
RETURN(); |
163 |
} |
164 |
$ENDOP |
165 |
|
166 |
/* candidate for helper (too long on x86 host) */ |
167 |
$OP lfd_z fpr PARAM |
168 |
{ |
169 |
regs->fpra = ld64(SPARAM(1)); |
170 |
RETURN(); |
171 |
} |
172 |
$ENDOP |
173 |
|
174 |
/* candidate for helper (too long) */ |
175 |
$OP lfd fpr PARAM |
176 |
{ |
177 |
T0 += SPARAM(1); |
178 |
regs->fpra = ld64(T0); |
179 |
RETURN(); |
180 |
} |
181 |
$ENDOP |
182 |
|
183 |
$OP lfdx_z fpr |
184 |
{ |
185 |
regs->fpra = ld64(T0); |
186 |
RETURN(); |
187 |
} |
188 |
$ENDOP |
189 |
|
190 |
$OP lfdx fpr |
191 |
{ |
192 |
T0 += T1; |
193 |
regs->fpra = ld64(T0); |
194 |
RETURN(); |
195 |
} |
196 |
$ENDOP |
197 |
/*****************************************************************************/ |