diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-02 18:28:06 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-02 18:28:06 +0000 |
commit | ccd4a2193765ca972bac5fe7567faf2ea95cdc98 (patch) | |
tree | f84c26da61276bc6ff03bf1d53ecfaf84bd8cc7e /target-sparc | |
parent | 00f219bf50f05f75706baa7e6660c9fd1095b666 (diff) |
Convert tick operations to TCG
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4011 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sparc')
-rw-r--r-- | target-sparc/cpu.h | 3 | ||||
-rw-r--r-- | target-sparc/helper.c | 6 | ||||
-rw-r--r-- | target-sparc/helper.h | 3 | ||||
-rw-r--r-- | target-sparc/op.c | 36 | ||||
-rw-r--r-- | target-sparc/translate.c | 100 |
5 files changed, 90 insertions, 58 deletions
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 8a4cdbc2d0..9b9d85687b 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -320,9 +320,6 @@ int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc); void raise_exception(int tt); void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec, int is_asi); -void do_tick_set_count(void *opaque, uint64_t count); -uint64_t do_tick_get_count(void *opaque); -void do_tick_set_limit(void *opaque, uint64_t limit); void cpu_check_irqs(CPUSPARCState *env); #define CPUState CPUSPARCState diff --git a/target-sparc/helper.c b/target-sparc/helper.c index 894e32628d..3437d13f66 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -612,14 +612,14 @@ void memcpy32(target_ulong *dst, const target_ulong *src) #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); @@ -628,7 +628,7 @@ uint64_t do_tick_get_count(void *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); diff --git a/target-sparc/helper.h b/target-sparc/helper.h index 28a0d6c000..3cdba6820b 100644 --- a/target-sparc/helper.h +++ b/target-sparc/helper.h @@ -19,6 +19,9 @@ helper_cas_asi(target_ulong addr, target_ulong val1, target_ulong TCG_HELPER_PROTO helper_casx_asi(target_ulong addr, target_ulong val1, target_ulong val2, uint32_t asi); +void TCG_HELPER_PROTO helper_tick_set_count(void *opaque, uint64_t count); +uint64_t TCG_HELPER_PROTO helper_tick_get_count(void *opaque); +void TCG_HELPER_PROTO helper_tick_set_limit(void *opaque, uint64_t limit); #endif void TCG_HELPER_PROTO helper_trap(target_ulong nb_trap); void TCG_HELPER_PROTO helper_trapcc(target_ulong nb_trap, diff --git a/target-sparc/op.c b/target-sparc/op.c index 11a5519cb8..ee5d56f4f2 100644 --- a/target-sparc/op.c +++ b/target-sparc/op.c @@ -806,42 +806,6 @@ void OPPROTO op_wrccr(void) 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]; diff --git a/target-sparc/translate.c b/target-sparc/translate.c index 58be1c78a0..f09be0d4cf 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -1204,8 +1204,16 @@ static void disas_sparc_insn(DisasContext * dc) 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); @@ -1228,8 +1236,16 @@ static void disas_sparc_insn(DisasContext * dc) 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)); @@ -1299,7 +1315,16 @@ static void disas_sparc_insn(DisasContext * dc) 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)); @@ -2281,26 +2306,52 @@ static void disas_sparc_insn(DisasContext * dc) 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 */ @@ -2366,7 +2417,15 @@ static void disas_sparc_insn(DisasContext * dc) 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)); @@ -2448,8 +2507,17 @@ static void disas_sparc_insn(DisasContext * dc) 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: |