aboutsummaryrefslogtreecommitdiff
path: root/target-sparc
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-21 18:08:59 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-21 18:08:59 +0000
commit2b29924f8c65fda8047e5c19f616ac5617b75a14 (patch)
tree53e89c79e53cc37ed97b3591c2d639117c3fba30 /target-sparc
parent2be17ebded1eb5add24674cc88e4833d5afaa980 (diff)
Convert align checks to TCG
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4097 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sparc')
-rw-r--r--target-sparc/helper.h1
-rw-r--r--target-sparc/op.c12
-rw-r--r--target-sparc/op_helper.c6
-rw-r--r--target-sparc/translate.c20
4 files changed, 27 insertions, 12 deletions
diff --git a/target-sparc/helper.h b/target-sparc/helper.h
index 4bf363b293..39dac74676 100644
--- a/target-sparc/helper.h
+++ b/target-sparc/helper.h
@@ -37,6 +37,7 @@ void TCG_HELPER_PROTO helper_tick_set_limit(void *opaque, uint64_t limit);
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_check_align(target_ulong addr, uint32_t align);
void TCG_HELPER_PROTO helper_debug(void);
void TCG_HELPER_PROTO helper_save(void);
void TCG_HELPER_PROTO helper_restore(void);
diff --git a/target-sparc/op.c b/target-sparc/op.c
index cc4aa14acb..e06cd8138d 100644
--- a/target-sparc/op.c
+++ b/target-sparc/op.c
@@ -36,15 +36,3 @@
#include "op_mem.h"
#endif
#endif
-
-#define CHECK_ALIGN_OP(align) \
- void OPPROTO op_check_align_T0_ ## align (void) \
- { \
- if (T0 & align) \
- raise_exception(TT_UNALIGNED); \
- FORCE_RET(); \
- }
-
-CHECK_ALIGN_OP(1)
-CHECK_ALIGN_OP(3)
-CHECK_ALIGN_OP(7)
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index 6e64eb807f..bc9bb179d6 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -50,6 +50,12 @@ void helper_trapcc(target_ulong nb_trap, target_ulong do_trap)
}
}
+void helper_check_align(target_ulong addr, uint32_t align)
+{
+ if (addr & align)
+ raise_exception(TT_UNALIGNED);
+}
+
#define F_HELPER(name, p) void helper_f##name##p(void)
#if defined(CONFIG_USER_ONLY)
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 69ce4cbfff..eb1906d682 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -1664,6 +1664,26 @@ static inline void gen_clear_float_exceptions(void)
tcg_gen_helper_0_0(helper_clear_float_exceptions);
}
+static inline void gen_check_align(TCGv r_addr, int align)
+{
+ tcg_gen_helper_0_2(helper_check_align, r_addr, tcg_const_i32(align));
+}
+
+static inline void gen_op_check_align_T0_1(void)
+{
+ gen_check_align(cpu_T[0], 1);
+}
+
+static inline void gen_op_check_align_T0_3(void)
+{
+ gen_check_align(cpu_T[0], 3);
+}
+
+static inline void gen_op_check_align_T0_7(void)
+{
+ gen_check_align(cpu_T[0], 7);
+}
+
/* asi moves */
#ifdef TARGET_SPARC64
static inline TCGv gen_get_asi(int insn, TCGv r_addr)