Lines Matching full:env
29 void raise_exception(CPURXState *env, int index,
32 static void _set_psw(CPURXState *env, uint32_t psw, uint32_t rte) in _set_psw() argument
35 prev_u = env->psw_u; in _set_psw()
36 rx_cpu_unpack_psw(env, psw, rte); in _set_psw()
37 if (prev_u != env->psw_u) { in _set_psw()
39 if (env->psw_u) { in _set_psw()
40 env->isp = env->regs[0]; in _set_psw()
41 env->regs[0] = env->usp; in _set_psw()
43 env->usp = env->regs[0]; in _set_psw()
44 env->regs[0] = env->isp; in _set_psw()
49 void helper_set_psw(CPURXState *env, uint32_t psw) in helper_set_psw() argument
51 _set_psw(env, psw, 0); in helper_set_psw()
54 void helper_set_psw_rte(CPURXState *env, uint32_t psw) in helper_set_psw_rte() argument
56 _set_psw(env, psw, 1); in helper_set_psw_rte()
59 uint32_t helper_pack_psw(CPURXState *env) in helper_pack_psw() argument
61 return rx_cpu_pack_psw(env); in helper_pack_psw()
66 env->fpsw = FIELD_DP32(env->fpsw, FPSW, C ## b, 1); \
67 if (!FIELD_EX32(env->fpsw, FPSW, E ## b)) { \
68 env->fpsw = FIELD_DP32(env->fpsw, FPSW, F ## b, 1); \
73 static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr) in update_fpsw() argument
77 env->psw_z = ret & ~(1 << 31); /* mask sign bit */ in update_fpsw()
78 env->psw_s = ret; in update_fpsw()
80 xcpt = get_float_exception_flags(&env->fp_status); in update_fpsw()
83 env->fpsw = FIELD_DP32(env->fpsw, FPSW, CAUSE, 0); in update_fpsw()
104 && !FIELD_EX32(env->fpsw, FPSW, DN)) { in update_fpsw()
105 env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1); in update_fpsw()
109 if (FIELD_EX32(env->fpsw, FPSW, FLAGS) != 0) { in update_fpsw()
110 env->fpsw = FIELD_DP32(env->fpsw, FPSW, FS, 1); in update_fpsw()
114 cause = FIELD_EX32(env->fpsw, FPSW, CAUSE); in update_fpsw()
115 enable = FIELD_EX32(env->fpsw, FPSW, ENABLE); in update_fpsw()
118 raise_exception(env, 21, retaddr); in update_fpsw()
123 void helper_set_fpsw(CPURXState *env, uint32_t val) in helper_set_fpsw() argument
131 uint32_t fpsw = env->fpsw; in helper_set_fpsw()
136 env->fpsw = fpsw; in helper_set_fpsw()
137 set_float_rounding_mode(roundmode[FIELD_EX32(env->fpsw, FPSW, RM)], in helper_set_fpsw()
138 &env->fp_status); in helper_set_fpsw()
142 float32 helper_##op(CPURXState *env, float32 t0, float32 t1) \
145 ret = func(t0, t1, &env->fp_status); \
146 update_fpsw(env, *(uint32_t *)&ret, GETPC()); \
155 void helper_fcmp(CPURXState *env, float32 t0, float32 t1) in FLOATOP()
158 st = float32_compare(t0, t1, &env->fp_status); in FLOATOP()
159 update_fpsw(env, 0, GETPC()); in FLOATOP()
160 env->psw_z = 1; in FLOATOP()
161 env->psw_s = env->psw_o = 0; in FLOATOP()
164 env->psw_z = 0; in FLOATOP()
167 env->psw_s = -1; in FLOATOP()
170 env->psw_o = -1; in FLOATOP()
175 uint32_t helper_ftoi(CPURXState *env, float32 t0) in helper_ftoi() argument
178 ret = float32_to_int32_round_to_zero(t0, &env->fp_status); in helper_ftoi()
179 update_fpsw(env, ret, GETPC()); in helper_ftoi()
183 uint32_t helper_round(CPURXState *env, float32 t0) in helper_round() argument
186 ret = float32_to_int32(t0, &env->fp_status); in helper_round()
187 update_fpsw(env, ret, GETPC()); in helper_round()
191 float32 helper_itof(CPURXState *env, uint32_t t0) in helper_itof() argument
194 ret = int32_to_float32(t0, &env->fp_status); in helper_itof()
195 update_fpsw(env, ret, GETPC()); in helper_itof()
200 void helper_scmpu(CPURXState *env) in helper_scmpu() argument
203 if (env->regs[3] == 0) { in helper_scmpu()
207 tmp0 = cpu_ldub_data_ra(env, env->regs[1]++, GETPC()); in helper_scmpu()
208 tmp1 = cpu_ldub_data_ra(env, env->regs[2]++, GETPC()); in helper_scmpu()
209 env->regs[3]--; in helper_scmpu()
213 } while (env->regs[3] != 0); in helper_scmpu()
214 env->psw_z = tmp0 - tmp1; in helper_scmpu()
215 env->psw_c = (tmp0 >= tmp1); in helper_scmpu()
218 static uint32_t (* const cpu_ldufn[])(CPUArchState *env,
224 static uint32_t (* const cpu_ldfn[])(CPUArchState *env,
230 static void (* const cpu_stfn[])(CPUArchState *env,
237 void helper_sstr(CPURXState *env, uint32_t sz) in helper_sstr() argument
240 while (env->regs[3] != 0) { in helper_sstr()
241 cpu_stfn[sz](env, env->regs[1], env->regs[2], GETPC()); in helper_sstr()
242 env->regs[1] += 1 << sz; in helper_sstr()
243 env->regs[3]--; in helper_sstr()
251 static void smov(uint32_t mode, CPURXState *env) in smov() argument
257 while (env->regs[3] != 0) { in smov()
258 tmp = cpu_ldub_data_ra(env, env->regs[2], GETPC()); in smov()
259 cpu_stb_data_ra(env, env->regs[1], tmp, GETPC()); in smov()
260 env->regs[1] += dir; in smov()
261 env->regs[2] += dir; in smov()
262 env->regs[3]--; in smov()
269 void helper_smovu(CPURXState *env) in helper_smovu() argument
271 smov(OP_SMOVU, env); in helper_smovu()
274 void helper_smovf(CPURXState *env) in helper_smovf() argument
276 smov(OP_SMOVF, env); in helper_smovf()
279 void helper_smovb(CPURXState *env) in helper_smovb() argument
281 smov(OP_SMOVB, env); in helper_smovb()
285 void helper_suntil(CPURXState *env, uint32_t sz) in helper_suntil() argument
289 if (env->regs[3] == 0) { in helper_suntil()
293 tmp = cpu_ldufn[sz](env, env->regs[1], GETPC()); in helper_suntil()
294 env->regs[1] += 1 << sz; in helper_suntil()
295 env->regs[3]--; in helper_suntil()
296 if (tmp == env->regs[2]) { in helper_suntil()
299 } while (env->regs[3] != 0); in helper_suntil()
300 env->psw_z = tmp - env->regs[2]; in helper_suntil()
301 env->psw_c = (tmp <= env->regs[2]); in helper_suntil()
304 void helper_swhile(CPURXState *env, uint32_t sz) in helper_swhile() argument
308 if (env->regs[3] == 0) { in helper_swhile()
312 tmp = cpu_ldufn[sz](env, env->regs[1], GETPC()); in helper_swhile()
313 env->regs[1] += 1 << sz; in helper_swhile()
314 env->regs[3]--; in helper_swhile()
315 if (tmp != env->regs[2]) { in helper_swhile()
318 } while (env->regs[3] != 0); in helper_swhile()
319 env->psw_z = env->regs[3]; in helper_swhile()
320 env->psw_c = (tmp <= env->regs[2]); in helper_swhile()
324 void helper_rmpa(CPURXState *env, uint32_t sz) in helper_rmpa() argument
330 if (env->regs[3] == 0) { in helper_rmpa()
333 result_l = env->regs[5]; in helper_rmpa()
335 result_l |= env->regs[4]; in helper_rmpa()
336 result_h = env->regs[6]; in helper_rmpa()
337 env->psw_o = 0; in helper_rmpa()
339 while (env->regs[3] != 0) { in helper_rmpa()
340 tmp0 = cpu_ldfn[sz](env, env->regs[1], GETPC()); in helper_rmpa()
341 tmp1 = cpu_ldfn[sz](env, env->regs[2], GETPC()); in helper_rmpa()
356 env->regs[1] += 1 << sz; in helper_rmpa()
357 env->regs[2] += 1 << sz; in helper_rmpa()
359 env->psw_s = result_h; in helper_rmpa()
360 env->psw_o = (result_h != 0 && result_h != -1) << 31; in helper_rmpa()
361 env->regs[6] = result_h; in helper_rmpa()
362 env->regs[5] = result_l >> 32; in helper_rmpa()
363 env->regs[4] = result_l & 0xffffffff; in helper_rmpa()
366 void helper_racw(CPURXState *env, uint32_t imm) in helper_racw() argument
369 acc = env->acc; in helper_racw()
379 env->acc = acc; in helper_racw()
382 void helper_satr(CPURXState *env) in helper_satr() argument
384 if (env->psw_o >> 31) { in helper_satr()
385 if ((int)env->psw_s < 0) { in helper_satr()
386 env->regs[6] = 0x00000000; in helper_satr()
387 env->regs[5] = 0x7fffffff; in helper_satr()
388 env->regs[4] = 0xffffffff; in helper_satr()
390 env->regs[6] = 0xffffffff; in helper_satr()
391 env->regs[5] = 0x80000000; in helper_satr()
392 env->regs[4] = 0x00000000; in helper_satr()
398 uint32_t helper_div(CPURXState *env, uint32_t num, uint32_t den) in helper_div() argument
403 env->psw_o = 0; in helper_div()
405 env->psw_o = -1; in helper_div()
410 uint32_t helper_divu(CPURXState *env, uint32_t num, uint32_t den) in helper_divu() argument
415 env->psw_o = 0; in helper_divu()
417 env->psw_o = -1; in helper_divu()
424 void raise_exception(CPURXState *env, int index, in raise_exception() argument
427 CPUState *cs = env_cpu(env); in raise_exception()
433 G_NORETURN void helper_raise_privilege_violation(CPURXState *env) in helper_raise_privilege_violation() argument
435 raise_exception(env, 20, GETPC()); in helper_raise_privilege_violation()
438 G_NORETURN void helper_raise_access_fault(CPURXState *env) in helper_raise_access_fault() argument
440 raise_exception(env, 21, GETPC()); in helper_raise_access_fault()
443 G_NORETURN void helper_raise_illegal_instruction(CPURXState *env) in helper_raise_illegal_instruction() argument
445 raise_exception(env, 23, GETPC()); in helper_raise_illegal_instruction()
448 G_NORETURN void helper_wait(CPURXState *env) in helper_wait() argument
450 CPUState *cs = env_cpu(env); in helper_wait()
453 env->in_sleep = 1; in helper_wait()
454 env->psw_i = 1; in helper_wait()
455 raise_exception(env, EXCP_HLT, 0); in helper_wait()
458 G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec) in helper_rxint() argument
460 raise_exception(env, 0x100 + vec, 0); in helper_rxint()
463 G_NORETURN void helper_rxbrk(CPURXState *env) in helper_rxbrk() argument
465 raise_exception(env, 0x100, 0); in helper_rxbrk()