#include "qemu-timer.h"
#endif
-void do_tick_set_count(void *opaque, uint64_t count)
+void helper_tick_set_count(void *opaque, uint64_t count)
{
#if !defined(CONFIG_USER_ONLY)
ptimer_set_count(opaque, -count);
#endif
}
-uint64_t do_tick_get_count(void *opaque)
+uint64_t helper_tick_get_count(void *opaque)
{
#if !defined(CONFIG_USER_ONLY)
return -ptimer_get_count(opaque);
#endif
}
-void do_tick_set_limit(void *opaque, uint64_t limit)
+void helper_tick_set_limit(void *opaque, uint64_t limit)
{
#if !defined(CONFIG_USER_ONLY)
ptimer_set_limit(opaque, -limit, 0);
PUT_CCR(env, T0);
}
-void OPPROTO op_rdtick(void)
-{
- T0 = do_tick_get_count(env->tick);
-}
-
-void OPPROTO op_wrtick(void)
-{
- do_tick_set_count(env->tick, T0);
-}
-
-void OPPROTO op_wrtick_cmpr(void)
-{
- do_tick_set_limit(env->tick, T0);
-}
-
-void OPPROTO op_rdstick(void)
-{
- T0 = do_tick_get_count(env->stick);
-}
-
-void OPPROTO op_wrstick(void)
-{
- do_tick_set_count(env->stick, T0);
- do_tick_set_count(env->hstick, T0);
-}
-
-void OPPROTO op_wrstick_cmpr(void)
-{
- do_tick_set_limit(env->stick, T0);
-}
-
-void OPPROTO op_wrhstick_cmpr(void)
-{
- do_tick_set_limit(env->hstick, T0);
-}
-
void OPPROTO op_rdtpc(void)
{
T0 = env->tpc[env->tl];
gen_movl_T0_reg(rd);
break;
case 0x4: /* V9 rdtick */
- gen_op_rdtick();
- gen_movl_T0_reg(rd);
+ {
+ TCGv r_tickptr;
+
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, tick));
+ tcg_gen_helper_1_1(helper_tick_get_count, cpu_T[0],
+ r_tickptr);
+ gen_movl_T0_reg(rd);
+ }
break;
case 0x5: /* V9 rdpc */
tcg_gen_movi_tl(cpu_T[0], dc->pc);
gen_movl_T0_reg(rd);
break;
case 0x18: /* System tick */
- gen_op_rdstick();
- gen_movl_T0_reg(rd);
+ {
+ TCGv r_tickptr;
+
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, stick));
+ tcg_gen_helper_1_1(helper_tick_get_count, cpu_T[0],
+ r_tickptr);
+ gen_movl_T0_reg(rd);
+ }
break;
case 0x19: /* System tick compare */
gen_op_movtl_T0_env(offsetof(CPUSPARCState, stick_cmpr));
gen_op_rdtt();
break;
case 4: // tick
- gen_op_rdtick();
+ {
+ TCGv r_tickptr;
+
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, tick));
+ tcg_gen_helper_1_1(helper_tick_get_count, cpu_T[0],
+ r_tickptr);
+ gen_movl_T0_reg(rd);
+ }
break;
case 5: // tba
gen_op_movtl_T0_env(offsetof(CPUSPARCState, tbr));
if (!supervisor(dc))
goto illegal_insn;
#endif
- gen_op_xor_T1_T0();
- gen_op_movtl_env_T0(offsetof(CPUSPARCState, tick_cmpr));
- gen_op_wrtick_cmpr();
+ {
+ TCGv r_tickptr;
+
+ gen_op_xor_T1_T0();
+ gen_op_movtl_env_T0(offsetof(CPUSPARCState,
+ tick_cmpr));
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, tick));
+ tcg_gen_helper_0_2(helper_tick_set_limit,
+ r_tickptr, cpu_T[0]);
+ }
break;
case 0x18: /* System tick */
#if !defined(CONFIG_USER_ONLY)
if (!supervisor(dc))
goto illegal_insn;
#endif
- gen_op_xor_T1_T0();
- gen_op_wrstick();
+ {
+ TCGv r_tickptr;
+
+ gen_op_xor_T1_T0();
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, stick));
+ tcg_gen_helper_0_2(helper_tick_set_count,
+ r_tickptr, cpu_T[0]);
+ }
break;
case 0x19: /* System tick compare */
#if !defined(CONFIG_USER_ONLY)
if (!supervisor(dc))
goto illegal_insn;
#endif
- gen_op_xor_T1_T0();
- gen_op_movtl_env_T0(offsetof(CPUSPARCState, stick_cmpr));
- gen_op_wrstick_cmpr();
+ {
+ TCGv r_tickptr;
+
+ gen_op_xor_T1_T0();
+ gen_op_movtl_env_T0(offsetof(CPUSPARCState,
+ stick_cmpr));
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, stick));
+ tcg_gen_helper_0_2(helper_tick_set_limit,
+ r_tickptr, cpu_T[0]);
+ }
break;
case 0x10: /* Performance Control */
gen_op_wrtt();
break;
case 4: // tick
- gen_op_wrtick();
+ {
+ TCGv r_tickptr;
+
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, tick));
+ tcg_gen_helper_0_2(helper_tick_set_count,
+ r_tickptr, cpu_T[0]);
+ }
break;
case 5: // tba
gen_op_movtl_env_T0(offsetof(CPUSPARCState, tbr));
gen_op_movl_env_T0(offsetof(CPUSPARCState, htba));
break;
case 31: // hstick_cmpr
- gen_op_movtl_env_T0(offsetof(CPUSPARCState, hstick_cmpr));
- gen_op_wrhstick_cmpr();
+ {
+ TCGv r_tickptr;
+
+ gen_op_movtl_env_T0(offsetof(CPUSPARCState,
+ hstick_cmpr));
+ r_tickptr = tcg_temp_new(TCG_TYPE_PTR);
+ tcg_gen_ld_ptr(r_tickptr, cpu_env,
+ offsetof(CPUState, hstick));
+ tcg_gen_helper_0_2(helper_tick_set_limit,
+ r_tickptr, cpu_T[0]);
+ }
break;
case 6: // hver readonly
default: