aboutsummaryrefslogtreecommitdiff
path: root/target-sparc
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-21 17:57:29 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-21 17:57:29 +0000
commit72a9747b79e2facf84a61248196d8fcf17665b35 (patch)
tree56b4dd64d32b85df0230ff3f0ea9af86c5b72b73 /target-sparc
parent44e7757c2afc4087b7253d227a7cbcfa52955dad (diff)
Convert save, restore, saved, restored, and flushw to TCG
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4092 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sparc')
-rw-r--r--target-sparc/helper.h5
-rw-r--r--target-sparc/op.c98
-rw-r--r--target-sparc/op_helper.c92
-rw-r--r--target-sparc/translate.c12
4 files changed, 103 insertions, 104 deletions
diff --git a/target-sparc/helper.h b/target-sparc/helper.h
index 0c04ddc238..4bf363b293 100644
--- a/target-sparc/helper.h
+++ b/target-sparc/helper.h
@@ -8,6 +8,9 @@ target_ulong TCG_HELPER_PROTO helper_rdpsr(void);
void TCG_HELPER_PROTO helper_wrpstate(target_ulong new_state);
void TCG_HELPER_PROTO helper_done(void);
void TCG_HELPER_PROTO helper_retry(void);
+void TCG_HELPER_PROTO helper_flushw(void);
+void TCG_HELPER_PROTO helper_saved(void);
+void TCG_HELPER_PROTO helper_restored(void);
target_ulong TCG_HELPER_PROTO helper_rdccr(void);
void TCG_HELPER_PROTO helper_wrccr(target_ulong new_ccr);
target_ulong TCG_HELPER_PROTO helper_rdcwp(void);
@@ -35,6 +38,8 @@ void TCG_HELPER_PROTO helper_trap(target_ulong nb_trap);
void TCG_HELPER_PROTO helper_trapcc(target_ulong nb_trap,
target_ulong do_trap);
void TCG_HELPER_PROTO helper_debug(void);
+void TCG_HELPER_PROTO helper_save(void);
+void TCG_HELPER_PROTO helper_restore(void);
void TCG_HELPER_PROTO helper_flush(target_ulong addr);
target_ulong TCG_HELPER_PROTO helper_udiv(target_ulong a, target_ulong b);
target_ulong TCG_HELPER_PROTO helper_sdiv(target_ulong a, target_ulong b);
diff --git a/target-sparc/op.c b/target-sparc/op.c
index 249061794a..99b9942e00 100644
--- a/target-sparc/op.c
+++ b/target-sparc/op.c
@@ -37,109 +37,11 @@
#endif
#endif
-#ifndef TARGET_SPARC64
-/* XXX: use another pointer for %iN registers to avoid slow wrapping
- handling ? */
-void OPPROTO op_save(void)
-{
- uint32_t cwp;
- cwp = (env->cwp - 1) & (NWINDOWS - 1);
- if (env->wim & (1 << cwp)) {
- raise_exception(TT_WIN_OVF);
- }
- set_cwp(cwp);
- FORCE_RET();
-}
-
-void OPPROTO op_restore(void)
-{
- uint32_t cwp;
- cwp = (env->cwp + 1) & (NWINDOWS - 1);
- if (env->wim & (1 << cwp)) {
- raise_exception(TT_WIN_UNF);
- }
- set_cwp(cwp);
- FORCE_RET();
-}
-#else
-/* XXX: use another pointer for %iN registers to avoid slow wrapping
- handling ? */
-void OPPROTO op_save(void)
-{
- uint32_t cwp;
- cwp = (env->cwp - 1) & (NWINDOWS - 1);
- if (env->cansave == 0) {
- raise_exception(TT_SPILL | (env->otherwin != 0 ?
- (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
- ((env->wstate & 0x7) << 2)));
- } else {
- if (env->cleanwin - env->canrestore == 0) {
- // XXX Clean windows without trap
- raise_exception(TT_CLRWIN);
- } else {
- env->cansave--;
- env->canrestore++;
- set_cwp(cwp);
- }
- }
- FORCE_RET();
-}
-
-void OPPROTO op_restore(void)
-{
- uint32_t cwp;
- cwp = (env->cwp + 1) & (NWINDOWS - 1);
- if (env->canrestore == 0) {
- raise_exception(TT_FILL | (env->otherwin != 0 ?
- (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
- ((env->wstate & 0x7) << 2)));
- } else {
- env->cansave++;
- env->canrestore--;
- set_cwp(cwp);
- }
- FORCE_RET();
-}
-#endif
-
void OPPROTO op_jmp_label(void)
{
GOTO_LABEL_PARAM(1);
}
-#ifdef TARGET_SPARC64
-void OPPROTO op_flushw(void)
-{
- if (env->cansave != NWINDOWS - 2) {
- raise_exception(TT_SPILL | (env->otherwin != 0 ?
- (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
- ((env->wstate & 0x7) << 2)));
- }
-}
-
-void OPPROTO op_saved(void)
-{
- env->cansave++;
- if (env->otherwin == 0)
- env->canrestore--;
- else
- env->otherwin--;
- FORCE_RET();
-}
-
-void OPPROTO op_restored(void)
-{
- env->canrestore++;
- if (env->cleanwin < NWINDOWS - 1)
- env->cleanwin++;
- if (env->otherwin == 0)
- env->cansave--;
- else
- env->otherwin--;
- FORCE_RET();
-}
-#endif
-
#define CHECK_ALIGN_OP(align) \
void OPPROTO op_check_align_T0_ ## align (void) \
{ \
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index c579275b84..6e64eb807f 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -2246,6 +2246,30 @@ void helper_debug(void)
}
#ifndef TARGET_SPARC64
+/* XXX: use another pointer for %iN registers to avoid slow wrapping
+ handling ? */
+void helper_save(void)
+{
+ uint32_t cwp;
+
+ cwp = (env->cwp - 1) & (NWINDOWS - 1);
+ if (env->wim & (1 << cwp)) {
+ raise_exception(TT_WIN_OVF);
+ }
+ set_cwp(cwp);
+}
+
+void helper_restore(void)
+{
+ uint32_t cwp;
+
+ cwp = (env->cwp + 1) & (NWINDOWS - 1);
+ if (env->wim & (1 << cwp)) {
+ raise_exception(TT_WIN_UNF);
+ }
+ set_cwp(cwp);
+}
+
void helper_wrpsr(target_ulong new_psr)
{
if ((new_psr & PSR_CWP) >= NWINDOWS)
@@ -2260,6 +2284,74 @@ target_ulong helper_rdpsr(void)
}
#else
+/* XXX: use another pointer for %iN registers to avoid slow wrapping
+ handling ? */
+void helper_save(void)
+{
+ uint32_t cwp;
+
+ cwp = (env->cwp - 1) & (NWINDOWS - 1);
+ if (env->cansave == 0) {
+ raise_exception(TT_SPILL | (env->otherwin != 0 ?
+ (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
+ ((env->wstate & 0x7) << 2)));
+ } else {
+ if (env->cleanwin - env->canrestore == 0) {
+ // XXX Clean windows without trap
+ raise_exception(TT_CLRWIN);
+ } else {
+ env->cansave--;
+ env->canrestore++;
+ set_cwp(cwp);
+ }
+ }
+}
+
+void helper_restore(void)
+{
+ uint32_t cwp;
+
+ cwp = (env->cwp + 1) & (NWINDOWS - 1);
+ if (env->canrestore == 0) {
+ raise_exception(TT_FILL | (env->otherwin != 0 ?
+ (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
+ ((env->wstate & 0x7) << 2)));
+ } else {
+ env->cansave++;
+ env->canrestore--;
+ set_cwp(cwp);
+ }
+}
+
+void helper_flushw(void)
+{
+ if (env->cansave != NWINDOWS - 2) {
+ raise_exception(TT_SPILL | (env->otherwin != 0 ?
+ (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
+ ((env->wstate & 0x7) << 2)));
+ }
+}
+
+void helper_saved(void)
+{
+ env->cansave++;
+ if (env->otherwin == 0)
+ env->canrestore--;
+ else
+ env->otherwin--;
+}
+
+void helper_restored(void)
+{
+ env->canrestore++;
+ if (env->cleanwin < NWINDOWS - 1)
+ env->cleanwin++;
+ if (env->otherwin == 0)
+ env->cansave--;
+ else
+ env->otherwin--;
+}
+
target_ulong helper_rdccr(void)
{
return GET_CCR(env);
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index ae5ae85186..0295fcd15e 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -2280,7 +2280,7 @@ static void disas_sparc_insn(DisasContext * dc)
break;
} else if (xop == 0x2b) { /* rdtbr / V9 flushw */
#ifdef TARGET_SPARC64
- gen_op_flushw();
+ tcg_gen_helper_0_0(helper_flushw);
#else
if (!supervisor(dc))
goto priv_insn;
@@ -3251,10 +3251,10 @@ static void disas_sparc_insn(DisasContext * dc)
#ifdef TARGET_SPARC64
switch (rd) {
case 0:
- gen_op_saved();
+ tcg_gen_helper_0_0(helper_saved);
break;
case 1:
- gen_op_restored();
+ tcg_gen_helper_0_0(helper_restored);
break;
case 2: /* UA2005 allclean */
case 3: /* UA2005 otherw */
@@ -3954,7 +3954,7 @@ static void disas_sparc_insn(DisasContext * dc)
}
#endif
}
- gen_op_restore();
+ tcg_gen_helper_0_0(helper_restore);
gen_mov_pc_npc(dc);
gen_op_check_align_T0_3();
tcg_gen_mov_tl(cpu_npc, cpu_T[0]);
@@ -4009,12 +4009,12 @@ static void disas_sparc_insn(DisasContext * dc)
break;
case 0x3c: /* save */
save_state(dc);
- gen_op_save();
+ tcg_gen_helper_0_0(helper_save);
gen_movl_T0_reg(rd);
break;
case 0x3d: /* restore */
save_state(dc);
- gen_op_restore();
+ tcg_gen_helper_0_0(helper_restore);
gen_movl_T0_reg(rd);
break;
#if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64)