aboutsummaryrefslogtreecommitdiff
path: root/target-microblaze/translate.c
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@gmail.com>2009-09-03 12:59:46 +0200
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2009-09-03 12:59:46 +0200
commit968a40f6fac887846d1316e737619233978a0cee (patch)
treec89eb5b892403b2c1b10254ab6040926d77b70bf /target-microblaze/translate.c
parent821ebb33e4e3b082b5d1d92b35fa3a9525dc43ce (diff)
microblaze: Trap on unaligned data accesses.
Untested... Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'target-microblaze/translate.c')
-rw-r--r--target-microblaze/translate.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 4fbe86a9a9..b863eb0a16 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -810,9 +810,16 @@ static void dec_load(DisasContext *dc)
/* If we get a fault on a dslot, the jmpstate better be in sync. */
sync_jmpstate(dc);
- if (dc->rd)
+
+ /* Verify alignment if needed. */
+ if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) {
+ gen_helper_memalign(*addr, tcg_const_tl(dc->rd),
+ tcg_const_tl(0), tcg_const_tl(size));
+ }
+
+ if (dc->rd) {
gen_load(dc, cpu_R[dc->rd], *addr, size);
- else {
+ } else {
gen_load(dc, env_imm, *addr, size);
}
@@ -847,6 +854,13 @@ static void dec_store(DisasContext *dc)
/* If we get a fault on a dslot, the jmpstate better be in sync. */
sync_jmpstate(dc);
addr = compute_ldst_addr(dc, &t);
+
+ /* Verify alignment if needed. */
+ if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) {
+ gen_helper_memalign(*addr, tcg_const_tl(dc->rd),
+ tcg_const_tl(1), tcg_const_tl(size));
+ }
+
gen_store(dc, *addr, cpu_R[dc->rd], size);
if (addr == &t)
tcg_temp_free(t);