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