root / target-sparc / win_helper.c @ a8a00822
History | View | Annotate | Download (9.4 kB)
1 | 070af384 | Blue Swirl | /*
|
---|---|---|---|
2 | 070af384 | Blue Swirl | * Helpers for CWP and PSTATE handling
|
3 | 070af384 | Blue Swirl | *
|
4 | 070af384 | Blue Swirl | * Copyright (c) 2003-2005 Fabrice Bellard
|
5 | 070af384 | Blue Swirl | *
|
6 | 070af384 | Blue Swirl | * This library is free software; you can redistribute it and/or
|
7 | 070af384 | Blue Swirl | * modify it under the terms of the GNU Lesser General Public
|
8 | 070af384 | Blue Swirl | * License as published by the Free Software Foundation; either
|
9 | 070af384 | Blue Swirl | * version 2 of the License, or (at your option) any later version.
|
10 | 070af384 | Blue Swirl | *
|
11 | 070af384 | Blue Swirl | * This library is distributed in the hope that it will be useful,
|
12 | 070af384 | Blue Swirl | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 070af384 | Blue Swirl | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 070af384 | Blue Swirl | * Lesser General Public License for more details.
|
15 | 070af384 | Blue Swirl | *
|
16 | 070af384 | Blue Swirl | * You should have received a copy of the GNU Lesser General Public
|
17 | 070af384 | Blue Swirl | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
18 | 070af384 | Blue Swirl | */
|
19 | 070af384 | Blue Swirl | |
20 | 070af384 | Blue Swirl | #include "cpu.h" |
21 | 070af384 | Blue Swirl | #include "helper.h" |
22 | 870be6ad | Blue Swirl | #include "trace.h" |
23 | 070af384 | Blue Swirl | |
24 | 070af384 | Blue Swirl | static inline void memcpy32(target_ulong *dst, const target_ulong *src) |
25 | 070af384 | Blue Swirl | { |
26 | 070af384 | Blue Swirl | dst[0] = src[0]; |
27 | 070af384 | Blue Swirl | dst[1] = src[1]; |
28 | 070af384 | Blue Swirl | dst[2] = src[2]; |
29 | 070af384 | Blue Swirl | dst[3] = src[3]; |
30 | 070af384 | Blue Swirl | dst[4] = src[4]; |
31 | 070af384 | Blue Swirl | dst[5] = src[5]; |
32 | 070af384 | Blue Swirl | dst[6] = src[6]; |
33 | 070af384 | Blue Swirl | dst[7] = src[7]; |
34 | 070af384 | Blue Swirl | } |
35 | 070af384 | Blue Swirl | |
36 | 063c3675 | Blue Swirl | void cpu_set_cwp(CPUState *env, int new_cwp) |
37 | 070af384 | Blue Swirl | { |
38 | 070af384 | Blue Swirl | /* put the modified wrap registers at their proper location */
|
39 | 070af384 | Blue Swirl | if (env->cwp == env->nwindows - 1) { |
40 | 070af384 | Blue Swirl | memcpy32(env->regbase, env->regbase + env->nwindows * 16);
|
41 | 070af384 | Blue Swirl | } |
42 | 070af384 | Blue Swirl | env->cwp = new_cwp; |
43 | 070af384 | Blue Swirl | |
44 | 070af384 | Blue Swirl | /* put the wrap registers at their temporary location */
|
45 | 070af384 | Blue Swirl | if (new_cwp == env->nwindows - 1) { |
46 | 070af384 | Blue Swirl | memcpy32(env->regbase + env->nwindows * 16, env->regbase);
|
47 | 070af384 | Blue Swirl | } |
48 | 070af384 | Blue Swirl | env->regwptr = env->regbase + (new_cwp * 16);
|
49 | 070af384 | Blue Swirl | } |
50 | 070af384 | Blue Swirl | |
51 | 063c3675 | Blue Swirl | target_ulong cpu_get_psr(CPUState *env) |
52 | 070af384 | Blue Swirl | { |
53 | 070af384 | Blue Swirl | helper_compute_psr(env); |
54 | 070af384 | Blue Swirl | |
55 | 070af384 | Blue Swirl | #if !defined(TARGET_SPARC64)
|
56 | 070af384 | Blue Swirl | return env->version | (env->psr & PSR_ICC) |
|
57 | 070af384 | Blue Swirl | (env->psref ? PSR_EF : 0) |
|
58 | 070af384 | Blue Swirl | (env->psrpil << 8) |
|
59 | 070af384 | Blue Swirl | (env->psrs ? PSR_S : 0) |
|
60 | 070af384 | Blue Swirl | (env->psrps ? PSR_PS : 0) |
|
61 | 070af384 | Blue Swirl | (env->psret ? PSR_ET : 0) | env->cwp;
|
62 | 070af384 | Blue Swirl | #else
|
63 | 070af384 | Blue Swirl | return env->psr & PSR_ICC;
|
64 | 070af384 | Blue Swirl | #endif
|
65 | 070af384 | Blue Swirl | } |
66 | 070af384 | Blue Swirl | |
67 | 063c3675 | Blue Swirl | void cpu_put_psr(CPUState *env, target_ulong val)
|
68 | 070af384 | Blue Swirl | { |
69 | 070af384 | Blue Swirl | env->psr = val & PSR_ICC; |
70 | 070af384 | Blue Swirl | #if !defined(TARGET_SPARC64)
|
71 | 070af384 | Blue Swirl | env->psref = (val & PSR_EF) ? 1 : 0; |
72 | 070af384 | Blue Swirl | env->psrpil = (val & PSR_PIL) >> 8;
|
73 | 070af384 | Blue Swirl | #endif
|
74 | 070af384 | Blue Swirl | #if ((!defined(TARGET_SPARC64)) && !defined(CONFIG_USER_ONLY))
|
75 | 070af384 | Blue Swirl | cpu_check_irqs(env); |
76 | 070af384 | Blue Swirl | #endif
|
77 | 070af384 | Blue Swirl | #if !defined(TARGET_SPARC64)
|
78 | 070af384 | Blue Swirl | env->psrs = (val & PSR_S) ? 1 : 0; |
79 | 070af384 | Blue Swirl | env->psrps = (val & PSR_PS) ? 1 : 0; |
80 | 070af384 | Blue Swirl | env->psret = (val & PSR_ET) ? 1 : 0; |
81 | 063c3675 | Blue Swirl | cpu_set_cwp(env, val & PSR_CWP); |
82 | 070af384 | Blue Swirl | #endif
|
83 | 070af384 | Blue Swirl | env->cc_op = CC_OP_FLAGS; |
84 | 070af384 | Blue Swirl | } |
85 | 070af384 | Blue Swirl | |
86 | 063c3675 | Blue Swirl | int cpu_cwp_inc(CPUState *env, int cwp) |
87 | 070af384 | Blue Swirl | { |
88 | 070af384 | Blue Swirl | if (unlikely(cwp >= env->nwindows)) {
|
89 | 070af384 | Blue Swirl | cwp -= env->nwindows; |
90 | 070af384 | Blue Swirl | } |
91 | 070af384 | Blue Swirl | return cwp;
|
92 | 070af384 | Blue Swirl | } |
93 | 070af384 | Blue Swirl | |
94 | 063c3675 | Blue Swirl | int cpu_cwp_dec(CPUState *env, int cwp) |
95 | 070af384 | Blue Swirl | { |
96 | 070af384 | Blue Swirl | if (unlikely(cwp < 0)) { |
97 | 070af384 | Blue Swirl | cwp += env->nwindows; |
98 | 070af384 | Blue Swirl | } |
99 | 070af384 | Blue Swirl | return cwp;
|
100 | 070af384 | Blue Swirl | } |
101 | 070af384 | Blue Swirl | |
102 | 070af384 | Blue Swirl | #ifndef TARGET_SPARC64
|
103 | 063c3675 | Blue Swirl | void helper_rett(CPUState *env)
|
104 | 070af384 | Blue Swirl | { |
105 | 070af384 | Blue Swirl | unsigned int cwp; |
106 | 070af384 | Blue Swirl | |
107 | 070af384 | Blue Swirl | if (env->psret == 1) { |
108 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_ILL_INSN); |
109 | 070af384 | Blue Swirl | } |
110 | 070af384 | Blue Swirl | |
111 | 070af384 | Blue Swirl | env->psret = 1;
|
112 | 063c3675 | Blue Swirl | cwp = cpu_cwp_inc(env, env->cwp + 1) ;
|
113 | 070af384 | Blue Swirl | if (env->wim & (1 << cwp)) { |
114 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_WIN_UNF); |
115 | 070af384 | Blue Swirl | } |
116 | 063c3675 | Blue Swirl | cpu_set_cwp(env, cwp); |
117 | 070af384 | Blue Swirl | env->psrs = env->psrps; |
118 | 070af384 | Blue Swirl | } |
119 | 070af384 | Blue Swirl | |
120 | 070af384 | Blue Swirl | /* XXX: use another pointer for %iN registers to avoid slow wrapping
|
121 | 070af384 | Blue Swirl | handling ? */
|
122 | 063c3675 | Blue Swirl | void helper_save(CPUState *env)
|
123 | 070af384 | Blue Swirl | { |
124 | 070af384 | Blue Swirl | uint32_t cwp; |
125 | 070af384 | Blue Swirl | |
126 | 063c3675 | Blue Swirl | cwp = cpu_cwp_dec(env, env->cwp - 1);
|
127 | 070af384 | Blue Swirl | if (env->wim & (1 << cwp)) { |
128 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_WIN_OVF); |
129 | 070af384 | Blue Swirl | } |
130 | 063c3675 | Blue Swirl | cpu_set_cwp(env, cwp); |
131 | 070af384 | Blue Swirl | } |
132 | 070af384 | Blue Swirl | |
133 | 063c3675 | Blue Swirl | void helper_restore(CPUState *env)
|
134 | 070af384 | Blue Swirl | { |
135 | 070af384 | Blue Swirl | uint32_t cwp; |
136 | 070af384 | Blue Swirl | |
137 | 063c3675 | Blue Swirl | cwp = cpu_cwp_inc(env, env->cwp + 1);
|
138 | 070af384 | Blue Swirl | if (env->wim & (1 << cwp)) { |
139 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_WIN_UNF); |
140 | 070af384 | Blue Swirl | } |
141 | 063c3675 | Blue Swirl | cpu_set_cwp(env, cwp); |
142 | 070af384 | Blue Swirl | } |
143 | 070af384 | Blue Swirl | |
144 | 063c3675 | Blue Swirl | void helper_wrpsr(CPUState *env, target_ulong new_psr)
|
145 | 070af384 | Blue Swirl | { |
146 | 070af384 | Blue Swirl | if ((new_psr & PSR_CWP) >= env->nwindows) {
|
147 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_ILL_INSN); |
148 | 070af384 | Blue Swirl | } else {
|
149 | 070af384 | Blue Swirl | cpu_put_psr(env, new_psr); |
150 | 070af384 | Blue Swirl | } |
151 | 070af384 | Blue Swirl | } |
152 | 070af384 | Blue Swirl | |
153 | 063c3675 | Blue Swirl | target_ulong helper_rdpsr(CPUState *env) |
154 | 070af384 | Blue Swirl | { |
155 | 063c3675 | Blue Swirl | return cpu_get_psr(env);
|
156 | 070af384 | Blue Swirl | } |
157 | 070af384 | Blue Swirl | |
158 | 070af384 | Blue Swirl | #else
|
159 | 070af384 | Blue Swirl | /* XXX: use another pointer for %iN registers to avoid slow wrapping
|
160 | 070af384 | Blue Swirl | handling ? */
|
161 | 063c3675 | Blue Swirl | void helper_save(CPUState *env)
|
162 | 070af384 | Blue Swirl | { |
163 | 070af384 | Blue Swirl | uint32_t cwp; |
164 | 070af384 | Blue Swirl | |
165 | 063c3675 | Blue Swirl | cwp = cpu_cwp_dec(env, env->cwp - 1);
|
166 | 070af384 | Blue Swirl | if (env->cansave == 0) { |
167 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_SPILL | (env->otherwin != 0 ?
|
168 | 070af384 | Blue Swirl | (TT_WOTHER | |
169 | 070af384 | Blue Swirl | ((env->wstate & 0x38) >> 1)) : |
170 | 070af384 | Blue Swirl | ((env->wstate & 0x7) << 2))); |
171 | 070af384 | Blue Swirl | } else {
|
172 | 070af384 | Blue Swirl | if (env->cleanwin - env->canrestore == 0) { |
173 | 070af384 | Blue Swirl | /* XXX Clean windows without trap */
|
174 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_CLRWIN); |
175 | 070af384 | Blue Swirl | } else {
|
176 | 070af384 | Blue Swirl | env->cansave--; |
177 | 070af384 | Blue Swirl | env->canrestore++; |
178 | 063c3675 | Blue Swirl | cpu_set_cwp(env, cwp); |
179 | 070af384 | Blue Swirl | } |
180 | 070af384 | Blue Swirl | } |
181 | 070af384 | Blue Swirl | } |
182 | 070af384 | Blue Swirl | |
183 | 063c3675 | Blue Swirl | void helper_restore(CPUState *env)
|
184 | 070af384 | Blue Swirl | { |
185 | 070af384 | Blue Swirl | uint32_t cwp; |
186 | 070af384 | Blue Swirl | |
187 | 063c3675 | Blue Swirl | cwp = cpu_cwp_inc(env, env->cwp + 1);
|
188 | 070af384 | Blue Swirl | if (env->canrestore == 0) { |
189 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_FILL | (env->otherwin != 0 ?
|
190 | 070af384 | Blue Swirl | (TT_WOTHER | |
191 | 070af384 | Blue Swirl | ((env->wstate & 0x38) >> 1)) : |
192 | 070af384 | Blue Swirl | ((env->wstate & 0x7) << 2))); |
193 | 070af384 | Blue Swirl | } else {
|
194 | 070af384 | Blue Swirl | env->cansave++; |
195 | 070af384 | Blue Swirl | env->canrestore--; |
196 | 063c3675 | Blue Swirl | cpu_set_cwp(env, cwp); |
197 | 070af384 | Blue Swirl | } |
198 | 070af384 | Blue Swirl | } |
199 | 070af384 | Blue Swirl | |
200 | 063c3675 | Blue Swirl | void helper_flushw(CPUState *env)
|
201 | 070af384 | Blue Swirl | { |
202 | 070af384 | Blue Swirl | if (env->cansave != env->nwindows - 2) { |
203 | 070af384 | Blue Swirl | helper_raise_exception(env, TT_SPILL | (env->otherwin != 0 ?
|
204 | 070af384 | Blue Swirl | (TT_WOTHER | |
205 | 070af384 | Blue Swirl | ((env->wstate & 0x38) >> 1)) : |
206 | 070af384 | Blue Swirl | ((env->wstate & 0x7) << 2))); |
207 | 070af384 | Blue Swirl | } |
208 | 070af384 | Blue Swirl | } |
209 | 070af384 | Blue Swirl | |
210 | 063c3675 | Blue Swirl | void helper_saved(CPUState *env)
|
211 | 070af384 | Blue Swirl | { |
212 | 070af384 | Blue Swirl | env->cansave++; |
213 | 070af384 | Blue Swirl | if (env->otherwin == 0) { |
214 | 070af384 | Blue Swirl | env->canrestore--; |
215 | 070af384 | Blue Swirl | } else {
|
216 | 070af384 | Blue Swirl | env->otherwin--; |
217 | 070af384 | Blue Swirl | } |
218 | 070af384 | Blue Swirl | } |
219 | 070af384 | Blue Swirl | |
220 | 063c3675 | Blue Swirl | void helper_restored(CPUState *env)
|
221 | 070af384 | Blue Swirl | { |
222 | 070af384 | Blue Swirl | env->canrestore++; |
223 | 070af384 | Blue Swirl | if (env->cleanwin < env->nwindows - 1) { |
224 | 070af384 | Blue Swirl | env->cleanwin++; |
225 | 070af384 | Blue Swirl | } |
226 | 070af384 | Blue Swirl | if (env->otherwin == 0) { |
227 | 070af384 | Blue Swirl | env->cansave--; |
228 | 070af384 | Blue Swirl | } else {
|
229 | 070af384 | Blue Swirl | env->otherwin--; |
230 | 070af384 | Blue Swirl | } |
231 | 070af384 | Blue Swirl | } |
232 | 070af384 | Blue Swirl | |
233 | 063c3675 | Blue Swirl | target_ulong cpu_get_ccr(CPUState *env) |
234 | 070af384 | Blue Swirl | { |
235 | 070af384 | Blue Swirl | target_ulong psr; |
236 | 070af384 | Blue Swirl | |
237 | 063c3675 | Blue Swirl | psr = cpu_get_psr(env); |
238 | 070af384 | Blue Swirl | |
239 | 070af384 | Blue Swirl | return ((env->xcc >> 20) << 4) | ((psr & PSR_ICC) >> 20); |
240 | 070af384 | Blue Swirl | } |
241 | 070af384 | Blue Swirl | |
242 | 063c3675 | Blue Swirl | void cpu_put_ccr(CPUState *env, target_ulong val)
|
243 | 070af384 | Blue Swirl | { |
244 | 070af384 | Blue Swirl | env->xcc = (val >> 4) << 20; |
245 | 070af384 | Blue Swirl | env->psr = (val & 0xf) << 20; |
246 | 070af384 | Blue Swirl | CC_OP = CC_OP_FLAGS; |
247 | 070af384 | Blue Swirl | } |
248 | 070af384 | Blue Swirl | |
249 | 063c3675 | Blue Swirl | target_ulong cpu_get_cwp64(CPUState *env) |
250 | 070af384 | Blue Swirl | { |
251 | 070af384 | Blue Swirl | return env->nwindows - 1 - env->cwp; |
252 | 070af384 | Blue Swirl | } |
253 | 070af384 | Blue Swirl | |
254 | 063c3675 | Blue Swirl | void cpu_put_cwp64(CPUState *env, int cwp) |
255 | 070af384 | Blue Swirl | { |
256 | 070af384 | Blue Swirl | if (unlikely(cwp >= env->nwindows || cwp < 0)) { |
257 | 070af384 | Blue Swirl | cwp %= env->nwindows; |
258 | 070af384 | Blue Swirl | } |
259 | 063c3675 | Blue Swirl | cpu_set_cwp(env, env->nwindows - 1 - cwp);
|
260 | 070af384 | Blue Swirl | } |
261 | 070af384 | Blue Swirl | |
262 | 063c3675 | Blue Swirl | target_ulong helper_rdccr(CPUState *env) |
263 | 070af384 | Blue Swirl | { |
264 | 063c3675 | Blue Swirl | return cpu_get_ccr(env);
|
265 | 070af384 | Blue Swirl | } |
266 | 070af384 | Blue Swirl | |
267 | 063c3675 | Blue Swirl | void helper_wrccr(CPUState *env, target_ulong new_ccr)
|
268 | 070af384 | Blue Swirl | { |
269 | 063c3675 | Blue Swirl | cpu_put_ccr(env, new_ccr); |
270 | 070af384 | Blue Swirl | } |
271 | 070af384 | Blue Swirl | |
272 | 070af384 | Blue Swirl | /* CWP handling is reversed in V9, but we still use the V8 register
|
273 | 070af384 | Blue Swirl | order. */
|
274 | 063c3675 | Blue Swirl | target_ulong helper_rdcwp(CPUState *env) |
275 | 070af384 | Blue Swirl | { |
276 | 063c3675 | Blue Swirl | return cpu_get_cwp64(env);
|
277 | 070af384 | Blue Swirl | } |
278 | 070af384 | Blue Swirl | |
279 | 063c3675 | Blue Swirl | void helper_wrcwp(CPUState *env, target_ulong new_cwp)
|
280 | 070af384 | Blue Swirl | { |
281 | 063c3675 | Blue Swirl | cpu_put_cwp64(env, new_cwp); |
282 | 070af384 | Blue Swirl | } |
283 | 070af384 | Blue Swirl | |
284 | 063c3675 | Blue Swirl | static inline uint64_t *get_gregset(CPUState *env, uint32_t pstate) |
285 | 070af384 | Blue Swirl | { |
286 | 070af384 | Blue Swirl | switch (pstate) {
|
287 | 070af384 | Blue Swirl | default:
|
288 | 870be6ad | Blue Swirl | trace_win_helper_gregset_error(pstate); |
289 | 070af384 | Blue Swirl | /* pass through to normal set of global registers */
|
290 | 070af384 | Blue Swirl | case 0: |
291 | 070af384 | Blue Swirl | return env->bgregs;
|
292 | 070af384 | Blue Swirl | case PS_AG:
|
293 | 070af384 | Blue Swirl | return env->agregs;
|
294 | 070af384 | Blue Swirl | case PS_MG:
|
295 | 070af384 | Blue Swirl | return env->mgregs;
|
296 | 070af384 | Blue Swirl | case PS_IG:
|
297 | 070af384 | Blue Swirl | return env->igregs;
|
298 | 070af384 | Blue Swirl | } |
299 | 070af384 | Blue Swirl | } |
300 | 070af384 | Blue Swirl | |
301 | 063c3675 | Blue Swirl | void cpu_change_pstate(CPUState *env, uint32_t new_pstate)
|
302 | 070af384 | Blue Swirl | { |
303 | 070af384 | Blue Swirl | uint32_t pstate_regs, new_pstate_regs; |
304 | 070af384 | Blue Swirl | uint64_t *src, *dst; |
305 | 070af384 | Blue Swirl | |
306 | 070af384 | Blue Swirl | if (env->def->features & CPU_FEATURE_GL) {
|
307 | 070af384 | Blue Swirl | /* PS_AG is not implemented in this case */
|
308 | 070af384 | Blue Swirl | new_pstate &= ~PS_AG; |
309 | 070af384 | Blue Swirl | } |
310 | 070af384 | Blue Swirl | |
311 | 070af384 | Blue Swirl | pstate_regs = env->pstate & 0xc01;
|
312 | 070af384 | Blue Swirl | new_pstate_regs = new_pstate & 0xc01;
|
313 | 070af384 | Blue Swirl | |
314 | 070af384 | Blue Swirl | if (new_pstate_regs != pstate_regs) {
|
315 | 870be6ad | Blue Swirl | trace_win_helper_switch_pstate(pstate_regs, new_pstate_regs); |
316 | 870be6ad | Blue Swirl | |
317 | 070af384 | Blue Swirl | /* Switch global register bank */
|
318 | 063c3675 | Blue Swirl | src = get_gregset(env, new_pstate_regs); |
319 | 063c3675 | Blue Swirl | dst = get_gregset(env, pstate_regs); |
320 | 070af384 | Blue Swirl | memcpy32(dst, env->gregs); |
321 | 070af384 | Blue Swirl | memcpy32(env->gregs, src); |
322 | 070af384 | Blue Swirl | } else {
|
323 | 870be6ad | Blue Swirl | trace_win_helper_no_switch_pstate(new_pstate_regs); |
324 | 070af384 | Blue Swirl | } |
325 | 070af384 | Blue Swirl | env->pstate = new_pstate; |
326 | 070af384 | Blue Swirl | } |
327 | 070af384 | Blue Swirl | |
328 | 063c3675 | Blue Swirl | void helper_wrpstate(CPUState *env, target_ulong new_state)
|
329 | 070af384 | Blue Swirl | { |
330 | 063c3675 | Blue Swirl | cpu_change_pstate(env, new_state & 0xf3f);
|
331 | 070af384 | Blue Swirl | |
332 | 070af384 | Blue Swirl | #if !defined(CONFIG_USER_ONLY)
|
333 | 070af384 | Blue Swirl | if (cpu_interrupts_enabled(env)) {
|
334 | 070af384 | Blue Swirl | cpu_check_irqs(env); |
335 | 070af384 | Blue Swirl | } |
336 | 070af384 | Blue Swirl | #endif
|
337 | 070af384 | Blue Swirl | } |
338 | 070af384 | Blue Swirl | |
339 | 063c3675 | Blue Swirl | void helper_wrpil(CPUState *env, target_ulong new_pil)
|
340 | 070af384 | Blue Swirl | { |
341 | 070af384 | Blue Swirl | #if !defined(CONFIG_USER_ONLY)
|
342 | 870be6ad | Blue Swirl | trace_win_helper_wrpil(env->psrpil, (uint32_t)new_pil); |
343 | 070af384 | Blue Swirl | |
344 | 070af384 | Blue Swirl | env->psrpil = new_pil; |
345 | 070af384 | Blue Swirl | |
346 | 070af384 | Blue Swirl | if (cpu_interrupts_enabled(env)) {
|
347 | 070af384 | Blue Swirl | cpu_check_irqs(env); |
348 | 070af384 | Blue Swirl | } |
349 | 070af384 | Blue Swirl | #endif
|
350 | 070af384 | Blue Swirl | } |
351 | 070af384 | Blue Swirl | |
352 | 063c3675 | Blue Swirl | void helper_done(CPUState *env)
|
353 | 070af384 | Blue Swirl | { |
354 | 070af384 | Blue Swirl | trap_state *tsptr = cpu_tsptr(env); |
355 | 070af384 | Blue Swirl | |
356 | 070af384 | Blue Swirl | env->pc = tsptr->tnpc; |
357 | 070af384 | Blue Swirl | env->npc = tsptr->tnpc + 4;
|
358 | 063c3675 | Blue Swirl | cpu_put_ccr(env, tsptr->tstate >> 32);
|
359 | 070af384 | Blue Swirl | env->asi = (tsptr->tstate >> 24) & 0xff; |
360 | 063c3675 | Blue Swirl | cpu_change_pstate(env, (tsptr->tstate >> 8) & 0xf3f); |
361 | 063c3675 | Blue Swirl | cpu_put_cwp64(env, tsptr->tstate & 0xff);
|
362 | 070af384 | Blue Swirl | env->tl--; |
363 | 070af384 | Blue Swirl | |
364 | 870be6ad | Blue Swirl | trace_win_helper_done(env->tl); |
365 | 070af384 | Blue Swirl | |
366 | 070af384 | Blue Swirl | #if !defined(CONFIG_USER_ONLY)
|
367 | 070af384 | Blue Swirl | if (cpu_interrupts_enabled(env)) {
|
368 | 070af384 | Blue Swirl | cpu_check_irqs(env); |
369 | 070af384 | Blue Swirl | } |
370 | 070af384 | Blue Swirl | #endif
|
371 | 070af384 | Blue Swirl | } |
372 | 070af384 | Blue Swirl | |
373 | 063c3675 | Blue Swirl | void helper_retry(CPUState *env)
|
374 | 070af384 | Blue Swirl | { |
375 | 070af384 | Blue Swirl | trap_state *tsptr = cpu_tsptr(env); |
376 | 070af384 | Blue Swirl | |
377 | 070af384 | Blue Swirl | env->pc = tsptr->tpc; |
378 | 070af384 | Blue Swirl | env->npc = tsptr->tnpc; |
379 | 063c3675 | Blue Swirl | cpu_put_ccr(env, tsptr->tstate >> 32);
|
380 | 070af384 | Blue Swirl | env->asi = (tsptr->tstate >> 24) & 0xff; |
381 | 063c3675 | Blue Swirl | cpu_change_pstate(env, (tsptr->tstate >> 8) & 0xf3f); |
382 | 063c3675 | Blue Swirl | cpu_put_cwp64(env, tsptr->tstate & 0xff);
|
383 | 070af384 | Blue Swirl | env->tl--; |
384 | 070af384 | Blue Swirl | |
385 | 870be6ad | Blue Swirl | trace_win_helper_retry(env->tl); |
386 | 070af384 | Blue Swirl | |
387 | 070af384 | Blue Swirl | #if !defined(CONFIG_USER_ONLY)
|
388 | 070af384 | Blue Swirl | if (cpu_interrupts_enabled(env)) {
|
389 | 070af384 | Blue Swirl | cpu_check_irqs(env); |
390 | 070af384 | Blue Swirl | } |
391 | 070af384 | Blue Swirl | #endif
|
392 | 070af384 | Blue Swirl | } |
393 | 070af384 | Blue Swirl | #endif |