summaryrefslogtreecommitdiff
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/op_helper.c
parentmicroblaze: Trap on divizions by zero. (diff)
downloadqemu-kvm-968a40f6fac887846d1316e737619233978a0cee.tar.gz
qemu-kvm-968a40f6fac887846d1316e737619233978a0cee.tar.bz2
qemu-kvm-968a40f6fac887846d1316e737619233978a0cee.zip
microblaze: Trap on unaligned data accesses.
Untested... Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'target-microblaze/op_helper.c')
-rw-r--r--target-microblaze/op_helper.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index 134d243e6..a5b382735 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -206,6 +206,33 @@ uint32_t helper_pcmpbf(uint32_t a, uint32_t b)
return 0;
}
+void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size)
+{
+ uint32_t mask;
+
+ switch (size) {
+ case 4: mask = 3; break;
+ case 2: mask = 1; break;
+ default:
+ case 1: mask = 0; break;
+ }
+
+ if (addr & mask) {
+ qemu_log("unaligned access addr=%x size=%d, wr=%d\n",
+ addr, size, wr);
+ if (!(env->sregs[SR_MSR] & MSR_EE)) {
+ return;
+ }
+
+ env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (wr << 10) \
+ | (dr & 31) << 5;
+ if (size == 4) {
+ env->sregs[SR_ESR] |= 1 << 11;
+ }
+ helper_raise_exception(EXCP_HW_EXCP);
+ }
+}
+
#if !defined(CONFIG_USER_ONLY)
/* Writes/reads to the MMU's special regs end up here. */
uint32_t helper_mmu_read(uint32_t rn)