root / target-ppc / op_helper.h @ ee4e83ed
History | View | Annotate | Download (10 kB)
1 |
/*
|
---|---|
2 |
* PowerPC emulation helpers header for qemu.
|
3 |
*
|
4 |
* Copyright (c) 2003-2007 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 |
#if defined(MEMSUFFIX)
|
22 |
|
23 |
/* Memory load/store helpers */
|
24 |
void glue(do_lsw, MEMSUFFIX) (int dst); |
25 |
void glue(do_lsw_le, MEMSUFFIX) (int dst); |
26 |
void glue(do_stsw, MEMSUFFIX) (int src); |
27 |
void glue(do_stsw_le, MEMSUFFIX) (int src); |
28 |
void glue(do_lmw, MEMSUFFIX) (int dst); |
29 |
void glue(do_lmw_le, MEMSUFFIX) (int dst); |
30 |
void glue(do_stmw, MEMSUFFIX) (int src); |
31 |
void glue(do_stmw_le, MEMSUFFIX) (int src); |
32 |
void glue(do_icbi, MEMSUFFIX) (void); |
33 |
void glue(do_dcbz, MEMSUFFIX) (void); |
34 |
void glue(do_POWER_lscbx, MEMSUFFIX) (int dest, int ra, int rb); |
35 |
void glue(do_POWER2_lfq, MEMSUFFIX) (void); |
36 |
void glue(do_POWER2_lfq_le, MEMSUFFIX) (void); |
37 |
void glue(do_POWER2_stfq, MEMSUFFIX) (void); |
38 |
void glue(do_POWER2_stfq_le, MEMSUFFIX) (void); |
39 |
|
40 |
#if defined(TARGET_PPC64)
|
41 |
void glue(do_lsw_64, MEMSUFFIX) (int dst); |
42 |
void glue(do_lsw_le_64, MEMSUFFIX) (int dst); |
43 |
void glue(do_stsw_64, MEMSUFFIX) (int src); |
44 |
void glue(do_stsw_le_64, MEMSUFFIX) (int src); |
45 |
void glue(do_lmw_64, MEMSUFFIX) (int dst); |
46 |
void glue(do_lmw_le_64, MEMSUFFIX) (int dst); |
47 |
void glue(do_stmw_64, MEMSUFFIX) (int src); |
48 |
void glue(do_stmw_le_64, MEMSUFFIX) (int src); |
49 |
void glue(do_icbi_64, MEMSUFFIX) (void); |
50 |
void glue(do_dcbz_64, MEMSUFFIX) (void); |
51 |
#endif
|
52 |
|
53 |
#else
|
54 |
|
55 |
void do_print_mem_EA (target_ulong EA);
|
56 |
|
57 |
/* Registers load and stores */
|
58 |
void do_load_cr (void); |
59 |
void do_store_cr (uint32_t mask);
|
60 |
#if defined(TARGET_PPC64)
|
61 |
void do_store_pri (int prio); |
62 |
#endif
|
63 |
void do_fpscr_setbit (int bit); |
64 |
void do_store_fpscr (uint32_t mask);
|
65 |
target_ulong ppc_load_dump_spr (int sprn);
|
66 |
void ppc_store_dump_spr (int sprn, target_ulong val); |
67 |
|
68 |
/* Integer arithmetic helpers */
|
69 |
void do_adde (void); |
70 |
void do_addmeo (void); |
71 |
void do_divwo (void); |
72 |
void do_divwuo (void); |
73 |
void do_mullwo (void); |
74 |
void do_nego (void); |
75 |
void do_subfe (void); |
76 |
void do_subfmeo (void); |
77 |
void do_subfzeo (void); |
78 |
void do_cntlzw (void); |
79 |
#if defined(TARGET_PPC64)
|
80 |
void do_cntlzd (void); |
81 |
#endif
|
82 |
void do_sraw (void); |
83 |
#if defined(TARGET_PPC64)
|
84 |
void do_adde_64 (void); |
85 |
void do_addmeo_64 (void); |
86 |
void do_divdo (void); |
87 |
void do_divduo (void); |
88 |
void do_mulldo (void); |
89 |
void do_nego_64 (void); |
90 |
void do_subfe_64 (void); |
91 |
void do_subfmeo_64 (void); |
92 |
void do_subfzeo_64 (void); |
93 |
void do_srad (void); |
94 |
#endif
|
95 |
void do_popcntb (void); |
96 |
#if defined(TARGET_PPC64)
|
97 |
void do_popcntb_64 (void); |
98 |
#endif
|
99 |
|
100 |
/* Floating-point arithmetic helpers */
|
101 |
void do_compute_fprf (int set_class); |
102 |
#ifdef CONFIG_SOFTFLOAT
|
103 |
void do_float_check_status (void); |
104 |
#endif
|
105 |
#if USE_PRECISE_EMULATION
|
106 |
void do_fadd (void); |
107 |
void do_fsub (void); |
108 |
void do_fmul (void); |
109 |
void do_fdiv (void); |
110 |
#endif
|
111 |
void do_fsqrt (void); |
112 |
void do_fre (void); |
113 |
void do_fres (void); |
114 |
void do_frsqrte (void); |
115 |
void do_fsel (void); |
116 |
#if USE_PRECISE_EMULATION
|
117 |
void do_fmadd (void); |
118 |
void do_fmsub (void); |
119 |
#endif
|
120 |
void do_fnmadd (void); |
121 |
void do_fnmsub (void); |
122 |
#if USE_PRECISE_EMULATION
|
123 |
void do_frsp (void); |
124 |
#endif
|
125 |
void do_fctiw (void); |
126 |
void do_fctiwz (void); |
127 |
#if defined(TARGET_PPC64)
|
128 |
void do_fcfid (void); |
129 |
void do_fctid (void); |
130 |
void do_fctidz (void); |
131 |
#endif
|
132 |
void do_frin (void); |
133 |
void do_friz (void); |
134 |
void do_frip (void); |
135 |
void do_frim (void); |
136 |
void do_fcmpu (void); |
137 |
void do_fcmpo (void); |
138 |
|
139 |
/* Misc */
|
140 |
void do_tw (int flags); |
141 |
#if defined(TARGET_PPC64)
|
142 |
void do_td (int flags); |
143 |
#endif
|
144 |
#if !defined(CONFIG_USER_ONLY)
|
145 |
void do_store_msr (void); |
146 |
void do_rfi (void); |
147 |
#if defined(TARGET_PPC64)
|
148 |
void do_rfid (void); |
149 |
#endif
|
150 |
#if defined(TARGET_PPC64H)
|
151 |
void do_hrfid (void); |
152 |
#endif
|
153 |
void do_load_6xx_tlb (int is_code); |
154 |
void do_load_74xx_tlb (int is_code); |
155 |
#endif
|
156 |
|
157 |
/* POWER / PowerPC 601 specific helpers */
|
158 |
void do_POWER_abso (void); |
159 |
void do_POWER_clcs (void); |
160 |
void do_POWER_div (void); |
161 |
void do_POWER_divo (void); |
162 |
void do_POWER_divs (void); |
163 |
void do_POWER_divso (void); |
164 |
void do_POWER_dozo (void); |
165 |
void do_POWER_maskg (void); |
166 |
void do_POWER_mulo (void); |
167 |
#if !defined(CONFIG_USER_ONLY)
|
168 |
void do_POWER_rac (void); |
169 |
void do_POWER_rfsvc (void); |
170 |
void do_store_hid0_601 (void); |
171 |
#endif
|
172 |
|
173 |
/* PowerPC 602 specific helper */
|
174 |
#if !defined(CONFIG_USER_ONLY)
|
175 |
void do_op_602_mfrom (void); |
176 |
#endif
|
177 |
|
178 |
/* PowerPC 440 specific helpers */
|
179 |
#if !defined(CONFIG_USER_ONLY)
|
180 |
void do_440_tlbre (int word); |
181 |
void do_440_tlbwe (int word); |
182 |
#endif
|
183 |
|
184 |
/* PowerPC 4xx specific helpers */
|
185 |
void do_405_check_ov (void); |
186 |
void do_405_check_sat (void); |
187 |
void do_load_dcr (void); |
188 |
void do_store_dcr (void); |
189 |
#if !defined(CONFIG_USER_ONLY)
|
190 |
void do_40x_rfci (void); |
191 |
void do_rfci (void); |
192 |
void do_rfdi (void); |
193 |
void do_rfmci (void); |
194 |
void do_4xx_tlbre_lo (void); |
195 |
void do_4xx_tlbre_hi (void); |
196 |
void do_4xx_tlbwe_lo (void); |
197 |
void do_4xx_tlbwe_hi (void); |
198 |
#endif
|
199 |
|
200 |
/* PowerPC 440 specific helpers */
|
201 |
void do_440_dlmzb (void); |
202 |
|
203 |
/* PowerPC 403 specific helpers */
|
204 |
#if !defined(CONFIG_USER_ONLY)
|
205 |
void do_load_403_pb (int num); |
206 |
void do_store_403_pb (int num); |
207 |
#endif
|
208 |
|
209 |
#if defined(TARGET_PPCEMB)
|
210 |
/* SPE extension helpers */
|
211 |
void do_brinc (void); |
212 |
/* Fixed-point vector helpers */
|
213 |
void do_evabs (void); |
214 |
void do_evaddw (void); |
215 |
void do_evcntlsw (void); |
216 |
void do_evcntlzw (void); |
217 |
void do_evneg (void); |
218 |
void do_evrlw (void); |
219 |
void do_evsel (void); |
220 |
void do_evrndw (void); |
221 |
void do_evslw (void); |
222 |
void do_evsrws (void); |
223 |
void do_evsrwu (void); |
224 |
void do_evsubfw (void); |
225 |
void do_evcmpeq (void); |
226 |
void do_evcmpgts (void); |
227 |
void do_evcmpgtu (void); |
228 |
void do_evcmplts (void); |
229 |
void do_evcmpltu (void); |
230 |
|
231 |
/* Single precision floating-point helpers */
|
232 |
void do_efscmplt (void); |
233 |
void do_efscmpgt (void); |
234 |
void do_efscmpeq (void); |
235 |
void do_efscfsf (void); |
236 |
void do_efscfuf (void); |
237 |
void do_efsctsf (void); |
238 |
void do_efsctuf (void); |
239 |
|
240 |
void do_efscfsi (void); |
241 |
void do_efscfui (void); |
242 |
void do_efsctsi (void); |
243 |
void do_efsctui (void); |
244 |
void do_efsctsiz (void); |
245 |
void do_efsctuiz (void); |
246 |
|
247 |
/* Double precision floating-point helpers */
|
248 |
void do_efdcmplt (void); |
249 |
void do_efdcmpgt (void); |
250 |
void do_efdcmpeq (void); |
251 |
void do_efdcfsf (void); |
252 |
void do_efdcfuf (void); |
253 |
void do_efdctsf (void); |
254 |
void do_efdctuf (void); |
255 |
|
256 |
void do_efdcfsi (void); |
257 |
void do_efdcfui (void); |
258 |
void do_efdctsi (void); |
259 |
void do_efdctui (void); |
260 |
void do_efdctsiz (void); |
261 |
void do_efdctuiz (void); |
262 |
|
263 |
void do_efdcfs (void); |
264 |
void do_efscfd (void); |
265 |
|
266 |
/* Floating-point vector helpers */
|
267 |
void do_evfsabs (void); |
268 |
void do_evfsnabs (void); |
269 |
void do_evfsneg (void); |
270 |
void do_evfsadd (void); |
271 |
void do_evfssub (void); |
272 |
void do_evfsmul (void); |
273 |
void do_evfsdiv (void); |
274 |
void do_evfscmplt (void); |
275 |
void do_evfscmpgt (void); |
276 |
void do_evfscmpeq (void); |
277 |
void do_evfststlt (void); |
278 |
void do_evfststgt (void); |
279 |
void do_evfststeq (void); |
280 |
void do_evfscfsi (void); |
281 |
void do_evfscfui (void); |
282 |
void do_evfscfsf (void); |
283 |
void do_evfscfuf (void); |
284 |
void do_evfsctsf (void); |
285 |
void do_evfsctuf (void); |
286 |
void do_evfsctsi (void); |
287 |
void do_evfsctui (void); |
288 |
void do_evfsctsiz (void); |
289 |
void do_evfsctuiz (void); |
290 |
#endif /* defined(TARGET_PPCEMB) */ |
291 |
|
292 |
#if defined(TARGET_PPCEMB)
|
293 |
/* SPE extension */
|
294 |
/* Single precision floating-point helpers */
|
295 |
static always_inline uint32_t _do_efsabs (uint32_t val)
|
296 |
{ |
297 |
return val & ~0x80000000; |
298 |
} |
299 |
static always_inline uint32_t _do_efsnabs (uint32_t val)
|
300 |
{ |
301 |
return val | 0x80000000; |
302 |
} |
303 |
static always_inline uint32_t _do_efsneg (uint32_t val)
|
304 |
{ |
305 |
return val ^ 0x80000000; |
306 |
} |
307 |
static always_inline uint32_t _do_efsadd (uint32_t op1, uint32_t op2)
|
308 |
{ |
309 |
union {
|
310 |
uint32_t u; |
311 |
float32 f; |
312 |
} u1, u2; |
313 |
u1.u = op1; |
314 |
u2.u = op2; |
315 |
u1.f = float32_add(u1.f, u2.f, &env->spe_status); |
316 |
return u1.u;
|
317 |
} |
318 |
static always_inline uint32_t _do_efssub (uint32_t op1, uint32_t op2)
|
319 |
{ |
320 |
union {
|
321 |
uint32_t u; |
322 |
float32 f; |
323 |
} u1, u2; |
324 |
u1.u = op1; |
325 |
u2.u = op2; |
326 |
u1.f = float32_sub(u1.f, u2.f, &env->spe_status); |
327 |
return u1.u;
|
328 |
} |
329 |
static always_inline uint32_t _do_efsmul (uint32_t op1, uint32_t op2)
|
330 |
{ |
331 |
union {
|
332 |
uint32_t u; |
333 |
float32 f; |
334 |
} u1, u2; |
335 |
u1.u = op1; |
336 |
u2.u = op2; |
337 |
u1.f = float32_mul(u1.f, u2.f, &env->spe_status); |
338 |
return u1.u;
|
339 |
} |
340 |
static always_inline uint32_t _do_efsdiv (uint32_t op1, uint32_t op2)
|
341 |
{ |
342 |
union {
|
343 |
uint32_t u; |
344 |
float32 f; |
345 |
} u1, u2; |
346 |
u1.u = op1; |
347 |
u2.u = op2; |
348 |
u1.f = float32_div(u1.f, u2.f, &env->spe_status); |
349 |
return u1.u;
|
350 |
} |
351 |
|
352 |
static always_inline int _do_efststlt (uint32_t op1, uint32_t op2) |
353 |
{ |
354 |
union {
|
355 |
uint32_t u; |
356 |
float32 f; |
357 |
} u1, u2; |
358 |
u1.u = op1; |
359 |
u2.u = op2; |
360 |
return float32_lt(u1.f, u2.f, &env->spe_status) ? 1 : 0; |
361 |
} |
362 |
static always_inline int _do_efststgt (uint32_t op1, uint32_t op2) |
363 |
{ |
364 |
union {
|
365 |
uint32_t u; |
366 |
float32 f; |
367 |
} u1, u2; |
368 |
u1.u = op1; |
369 |
u2.u = op2; |
370 |
return float32_le(u1.f, u2.f, &env->spe_status) ? 0 : 1; |
371 |
} |
372 |
static always_inline int _do_efststeq (uint32_t op1, uint32_t op2) |
373 |
{ |
374 |
union {
|
375 |
uint32_t u; |
376 |
float32 f; |
377 |
} u1, u2; |
378 |
u1.u = op1; |
379 |
u2.u = op2; |
380 |
return float32_eq(u1.f, u2.f, &env->spe_status) ? 1 : 0; |
381 |
} |
382 |
/* Double precision floating-point helpers */
|
383 |
static always_inline int _do_efdtstlt (uint64_t op1, uint64_t op2) |
384 |
{ |
385 |
union {
|
386 |
uint64_t u; |
387 |
float64 f; |
388 |
} u1, u2; |
389 |
u1.u = op1; |
390 |
u2.u = op2; |
391 |
return float64_lt(u1.f, u2.f, &env->spe_status) ? 1 : 0; |
392 |
} |
393 |
static always_inline int _do_efdtstgt (uint64_t op1, uint64_t op2) |
394 |
{ |
395 |
union {
|
396 |
uint64_t u; |
397 |
float64 f; |
398 |
} u1, u2; |
399 |
u1.u = op1; |
400 |
u2.u = op2; |
401 |
return float64_le(u1.f, u2.f, &env->spe_status) ? 0 : 1; |
402 |
} |
403 |
static always_inline int _do_efdtsteq (uint64_t op1, uint64_t op2) |
404 |
{ |
405 |
union {
|
406 |
uint64_t u; |
407 |
float64 f; |
408 |
} u1, u2; |
409 |
u1.u = op1; |
410 |
u2.u = op2; |
411 |
return float64_eq(u1.f, u2.f, &env->spe_status) ? 1 : 0; |
412 |
} |
413 |
#endif /* defined(TARGET_PPCEMB) */ |
414 |
#endif
|