aboutsummaryrefslogtreecommitdiffstats
path: root/target-microblaze
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@gmail.com>2009-09-03 13:25:09 +0200
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2009-09-03 13:25:09 +0200
commitfaed1c2a23373e5b6a77c9b2c6e2a01160ea5c30 (patch)
treec2a146e99773d32a9bf5f15d32308965566fcb37 /target-microblaze
parent3c50a71fc933c0ffba82c95111fa780e6110d79f (diff)
microblaze: Trap on bus accesses to unmapped areas.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'target-microblaze')
-rw-r--r--target-microblaze/cpu.h3
-rw-r--r--target-microblaze/op_helper.c27
2 files changed, 30 insertions, 0 deletions
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 5dc2b7d5c..1bf4875ec 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -323,4 +323,7 @@ static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
env->iflags |= env->sregs[SR_MSR] & MSR_EE;
*flags = env->iflags & IFLAGS_TB_MASK;
}
+
+void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
+ int is_asi, int size);
#endif
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index a5b382735..2cc4ced17 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -245,3 +245,30 @@ void helper_mmu_write(uint32_t rn, uint32_t v)
mmu_write(env, rn, v);
}
#endif
+
+void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
+ int is_asi, int size)
+{
+ CPUState *saved_env;
+ /* XXX: hack to restore env in all cases, even if not called from
+ generated code */
+ saved_env = env;
+ env = cpu_single_env;
+ qemu_log("Unassigned " TARGET_FMT_plx " wr=%d exe=%d\n",
+ addr, is_write, is_exec);
+ if (!(env->sregs[SR_MSR] & MSR_EE)) {
+ return;
+ }
+
+ if (is_exec) {
+ if (!(env->pvr.regs[2] & PVR2_IOPB_BUS_EXC_MASK)) {
+ env->sregs[SR_ESR] = ESR_EC_INSN_BUS;
+ helper_raise_exception(EXCP_HW_EXCP);
+ }
+ } else {
+ if (!(env->pvr.regs[2] & PVR2_DOPB_BUS_EXC_MASK)) {
+ env->sregs[SR_ESR] = ESR_EC_DATA_BUS;
+ helper_raise_exception(EXCP_HW_EXCP);
+ }
+ }
+}