From c658b94f6e8c206c59d02aa6fbac285b86b53d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 27 May 2013 06:49:53 +0200 Subject: cpu: Turn cpu_unassigned_access() into a CPUState hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use it for all targets, but be careful not to pass invalid CPUState. cpu_single_env can be NULL, e.g. on Xen. Signed-off-by: Andreas Färber --- target-microblaze/cpu.c | 2 +- target-microblaze/cpu.h | 5 +++-- target-microblaze/op_helper.c | 17 +++++++++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'target-microblaze') diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c index b9a097c..a0fcdf4 100644 --- a/target-microblaze/cpu.c +++ b/target-microblaze/cpu.c @@ -138,8 +138,8 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) cc->do_interrupt = mb_cpu_do_interrupt; cc->dump_state = mb_cpu_dump_state; + cpu_class_set_do_unassigned_access(cc, mb_cpu_unassigned_access); dc->vmsd = &vmstate_mb_cpu; - dc->props = mb_properties; } diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 1813939..75ae5ba 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -367,8 +367,9 @@ static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc, } #if !defined(CONFIG_USER_ONLY) -void cpu_unassigned_access(CPUMBState *env1, hwaddr addr, - int is_write, int is_exec, int is_asi, int size); +void mb_cpu_unassigned_access(CPUState *cpu, hwaddr addr, + bool is_write, bool is_exec, int is_asi, + unsigned size); #endif static inline bool cpu_has_work(CPUState *cpu) diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c index f2cb88b..14baa84 100644 --- a/target-microblaze/op_helper.c +++ b/target-microblaze/op_helper.c @@ -495,12 +495,21 @@ void helper_mmu_write(CPUMBState *env, uint32_t rn, uint32_t v) mmu_write(env, rn, v); } -void cpu_unassigned_access(CPUMBState *env, hwaddr addr, - int is_write, int is_exec, int is_asi, int size) +void mb_cpu_unassigned_access(CPUState *cs, hwaddr addr, + bool is_write, bool is_exec, int is_asi, + unsigned size) { + MicroBlazeCPU *cpu; + CPUMBState *env; + qemu_log_mask(CPU_LOG_INT, "Unassigned " TARGET_FMT_plx " wr=%d exe=%d\n", - addr, is_write, is_exec); - if (!env || !(env->sregs[SR_MSR] & MSR_EE)) { + addr, is_write ? 1 : 0, is_exec ? 1 : 0); + if (cs == NULL) { + return; + } + cpu = MICROBLAZE_CPU(cs); + env = &cpu->env; + if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } -- cgit v1.1