Lines Matching full:env

28 void raise_exception(CPURXState *env, int index,
31 static void _set_psw(CPURXState *env, uint32_t psw, uint32_t rte) in _set_psw() argument
34 prev_u = env->psw_u; in _set_psw()
35 rx_cpu_unpack_psw(env, psw, rte); in _set_psw()
36 if (prev_u != env->psw_u) { in _set_psw()
38 if (env->psw_u) { in _set_psw()
39 env->isp = env->regs[0]; in _set_psw()
40 env->regs[0] = env->usp; in _set_psw()
42 env->usp = env->regs[0]; in _set_psw()
43 env->regs[0] = env->isp; in _set_psw()
48 void helper_set_psw(CPURXState *env, uint32_t psw) in helper_set_psw() argument
50 _set_psw(env, psw, 0); in helper_set_psw()
53 void helper_set_psw_rte(CPURXState *env, uint32_t psw) in helper_set_psw_rte() argument
55 _set_psw(env, psw, 1); in helper_set_psw_rte()
58 uint32_t helper_pack_psw(CPURXState *env) in helper_pack_psw() argument
60 return rx_cpu_pack_psw(env); in helper_pack_psw()
65 env->fpsw = FIELD_DP32(env->fpsw, FPSW, C ## b, 1); \
66 if (!FIELD_EX32(env->fpsw, FPSW, E ## b)) { \
67 env->fpsw = FIELD_DP32(env->fpsw, FPSW, F ## b, 1); \
72 static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr) in update_fpsw() argument
76 env->psw_z = ret & ~(1 << 31); /* mask sign bit */ in update_fpsw()
77 env->psw_s = ret; in update_fpsw()
79 xcpt = get_float_exception_flags(&env->fp_status); in update_fpsw()
82 env->fpsw = FIELD_DP32(env->fpsw, FPSW, CAUSE, 0); in update_fpsw()
103 && !FIELD_EX32(env->fpsw, FPSW, DN)) { in update_fpsw()
104 env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1); in update_fpsw()
108 if (FIELD_EX32(env->fpsw, FPSW, FLAGS) != 0) { in update_fpsw()
109 env->fpsw = FIELD_DP32(env->fpsw, FPSW, FS, 1); in update_fpsw()
113 cause = FIELD_EX32(env->fpsw, FPSW, CAUSE); in update_fpsw()
114 enable = FIELD_EX32(env->fpsw, FPSW, ENABLE); in update_fpsw()
117 raise_exception(env, 21, retaddr); in update_fpsw()
122 void helper_set_fpsw(CPURXState *env, uint32_t val) in helper_set_fpsw() argument
130 uint32_t fpsw = env->fpsw; in helper_set_fpsw()
135 env->fpsw = fpsw; in helper_set_fpsw()
136 set_float_rounding_mode(roundmode[FIELD_EX32(env->fpsw, FPSW, RM)], in helper_set_fpsw()
137 &env->fp_status); in helper_set_fpsw()
141 float32 helper_##op(CPURXState *env, float32 t0, float32 t1) \
144 ret = func(t0, t1, &env->fp_status); \
145 update_fpsw(env, *(uint32_t *)&ret, GETPC()); \
154 void helper_fcmp(CPURXState *env, float32 t0, float32 t1) in FLOATOP()
157 st = float32_compare(t0, t1, &env->fp_status); in FLOATOP()
158 update_fpsw(env, 0, GETPC()); in FLOATOP()
159 env->psw_z = 1; in FLOATOP()
160 env->psw_s = env->psw_o = 0; in FLOATOP()
163 env->psw_z = 0; in FLOATOP()
166 env->psw_s = -1; in FLOATOP()
169 env->psw_o = -1; in FLOATOP()
174 uint32_t helper_ftoi(CPURXState *env, float32 t0) in helper_ftoi() argument
177 ret = float32_to_int32_round_to_zero(t0, &env->fp_status); in helper_ftoi()
178 update_fpsw(env, ret, GETPC()); in helper_ftoi()
182 uint32_t helper_round(CPURXState *env, float32 t0) in helper_round() argument
185 ret = float32_to_int32(t0, &env->fp_status); in helper_round()
186 update_fpsw(env, ret, GETPC()); in helper_round()
190 float32 helper_itof(CPURXState *env, uint32_t t0) in helper_itof() argument
193 ret = int32_to_float32(t0, &env->fp_status); in helper_itof()
194 update_fpsw(env, ret, GETPC()); in helper_itof()
199 void helper_scmpu(CPURXState *env) in helper_scmpu() argument
202 if (env->regs[3] == 0) { in helper_scmpu()
206 tmp0 = cpu_ldub_data_ra(env, env->regs[1]++, GETPC()); in helper_scmpu()
207 tmp1 = cpu_ldub_data_ra(env, env->regs[2]++, GETPC()); in helper_scmpu()
208 env->regs[3]--; in helper_scmpu()
212 } while (env->regs[3] != 0); in helper_scmpu()
213 env->psw_z = tmp0 - tmp1; in helper_scmpu()
214 env->psw_c = (tmp0 >= tmp1); in helper_scmpu()
217 static uint32_t (* const cpu_ldufn[])(CPUArchState *env,
223 static uint32_t (* const cpu_ldfn[])(CPUArchState *env,
229 static void (* const cpu_stfn[])(CPUArchState *env,
236 void helper_sstr(CPURXState *env, uint32_t sz) in helper_sstr() argument
239 while (env->regs[3] != 0) { in helper_sstr()
240 cpu_stfn[sz](env, env->regs[1], env->regs[2], GETPC()); in helper_sstr()
241 env->regs[1] += 1 << sz; in helper_sstr()
242 env->regs[3]--; in helper_sstr()
250 static void smov(uint32_t mode, CPURXState *env) in smov() argument
256 while (env->regs[3] != 0) { in smov()
257 tmp = cpu_ldub_data_ra(env, env->regs[2], GETPC()); in smov()
258 cpu_stb_data_ra(env, env->regs[1], tmp, GETPC()); in smov()
259 env->regs[1] += dir; in smov()
260 env->regs[2] += dir; in smov()
261 env->regs[3]--; in smov()
268 void helper_smovu(CPURXState *env) in helper_smovu() argument
270 smov(OP_SMOVU, env); in helper_smovu()
273 void helper_smovf(CPURXState *env) in helper_smovf() argument
275 smov(OP_SMOVF, env); in helper_smovf()
278 void helper_smovb(CPURXState *env) in helper_smovb() argument
280 smov(OP_SMOVB, env); in helper_smovb()
284 void helper_suntil(CPURXState *env, uint32_t sz) in helper_suntil() argument
288 if (env->regs[3] == 0) { in helper_suntil()
292 tmp = cpu_ldufn[sz](env, env->regs[1], GETPC()); in helper_suntil()
293 env->regs[1] += 1 << sz; in helper_suntil()
294 env->regs[3]--; in helper_suntil()
295 if (tmp == env->regs[2]) { in helper_suntil()
298 } while (env->regs[3] != 0); in helper_suntil()
299 env->psw_z = tmp - env->regs[2]; in helper_suntil()
300 env->psw_c = (tmp <= env->regs[2]); in helper_suntil()
303 void helper_swhile(CPURXState *env, uint32_t sz) in helper_swhile() argument
307 if (env->regs[3] == 0) { in helper_swhile()
311 tmp = cpu_ldufn[sz](env, env->regs[1], GETPC()); in helper_swhile()
312 env->regs[1] += 1 << sz; in helper_swhile()
313 env->regs[3]--; in helper_swhile()
314 if (tmp != env->regs[2]) { in helper_swhile()
317 } while (env->regs[3] != 0); in helper_swhile()
318 env->psw_z = env->regs[3]; in helper_swhile()
319 env->psw_c = (tmp <= env->regs[2]); in helper_swhile()
323 void helper_rmpa(CPURXState *env, uint32_t sz) in helper_rmpa() argument
329 if (env->regs[3] == 0) { in helper_rmpa()
332 result_l = env->regs[5]; in helper_rmpa()
334 result_l |= env->regs[4]; in helper_rmpa()
335 result_h = env->regs[6]; in helper_rmpa()
336 env->psw_o = 0; in helper_rmpa()
338 while (env->regs[3] != 0) { in helper_rmpa()
339 tmp0 = cpu_ldfn[sz](env, env->regs[1], GETPC()); in helper_rmpa()
340 tmp1 = cpu_ldfn[sz](env, env->regs[2], GETPC()); in helper_rmpa()
355 env->regs[1] += 1 << sz; in helper_rmpa()
356 env->regs[2] += 1 << sz; in helper_rmpa()
358 env->psw_s = result_h; in helper_rmpa()
359 env->psw_o = (result_h != 0 && result_h != -1) << 31; in helper_rmpa()
360 env->regs[6] = result_h; in helper_rmpa()
361 env->regs[5] = result_l >> 32; in helper_rmpa()
362 env->regs[4] = result_l & 0xffffffff; in helper_rmpa()
365 void helper_racw(CPURXState *env, uint32_t imm) in helper_racw() argument
368 acc = env->acc; in helper_racw()
378 env->acc = acc; in helper_racw()
381 void helper_satr(CPURXState *env) in helper_satr() argument
383 if (env->psw_o >> 31) { in helper_satr()
384 if ((int)env->psw_s < 0) { in helper_satr()
385 env->regs[6] = 0x00000000; in helper_satr()
386 env->regs[5] = 0x7fffffff; in helper_satr()
387 env->regs[4] = 0xffffffff; in helper_satr()
389 env->regs[6] = 0xffffffff; in helper_satr()
390 env->regs[5] = 0x80000000; in helper_satr()
391 env->regs[4] = 0x00000000; in helper_satr()
397 uint32_t helper_div(CPURXState *env, uint32_t num, uint32_t den) in helper_div() argument
402 env->psw_o = 0; in helper_div()
404 env->psw_o = -1; in helper_div()
409 uint32_t helper_divu(CPURXState *env, uint32_t num, uint32_t den) in helper_divu() argument
414 env->psw_o = 0; in helper_divu()
416 env->psw_o = -1; in helper_divu()
423 void raise_exception(CPURXState *env, int index, in raise_exception() argument
426 CPUState *cs = env_cpu(env); in raise_exception()
432 G_NORETURN void helper_raise_privilege_violation(CPURXState *env) in helper_raise_privilege_violation() argument
434 raise_exception(env, 20, GETPC()); in helper_raise_privilege_violation()
437 G_NORETURN void helper_raise_access_fault(CPURXState *env) in helper_raise_access_fault() argument
439 raise_exception(env, 21, GETPC()); in helper_raise_access_fault()
442 G_NORETURN void helper_raise_illegal_instruction(CPURXState *env) in helper_raise_illegal_instruction() argument
444 raise_exception(env, 23, GETPC()); in helper_raise_illegal_instruction()
447 G_NORETURN void helper_wait(CPURXState *env) in helper_wait() argument
449 CPUState *cs = env_cpu(env); in helper_wait()
452 env->in_sleep = 1; in helper_wait()
453 env->psw_i = 1; in helper_wait()
454 raise_exception(env, EXCP_HLT, 0); in helper_wait()
457 G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec) in helper_rxint() argument
459 raise_exception(env, 0x100 + vec, 0); in helper_rxint()
462 G_NORETURN void helper_rxbrk(CPURXState *env) in helper_rxbrk() argument
464 raise_exception(env, 0x100, 0); in helper_rxbrk()