From 5b4504079a3bc37f85cce44e77c347e9ec742307 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 18 Apr 2011 16:13:12 -0700 Subject: target-alpha: Trap for unassigned and unaligned addresses. Signed-off-by: Richard Henderson --- target-alpha/cpu.h | 6 +++++- target-alpha/op_helper.c | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'target-alpha') diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 030ed17679..e98b32513c 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -434,7 +434,11 @@ void do_interrupt (CPUState *env); uint64_t cpu_alpha_load_fpcr (CPUState *env); void cpu_alpha_store_fpcr (CPUState *env, uint64_t val); -extern void swap_shadow_regs(CPUState *env); +#ifndef CONFIG_USER_ONLY +void swap_shadow_regs(CPUState *env); +extern QEMU_NORETURN void do_unassigned_access(target_phys_addr_t addr, + int, int, int, int); +#endif /* Bits in TB->FLAGS that control how translation is processed. */ enum { diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c index 03b5091234..91ef90a07c 100644 --- a/target-alpha/op_helper.c +++ b/target-alpha/op_helper.c @@ -1265,7 +1265,33 @@ uint64_t helper_stq_c_phys(uint64_t p, uint64_t v) return ret; } +static void QEMU_NORETURN do_unaligned_access(target_ulong addr, int is_write, + int is_user, void *retaddr) +{ + uint64_t pc; + uint32_t insn; + + do_restore_state(retaddr); + + pc = env->pc; + insn = ldl_code(pc); + + env->trap_arg0 = addr; + env->trap_arg1 = insn >> 26; /* opcode */ + env->trap_arg2 = (insn >> 21) & 31; /* dest regno */ + helper_excp(EXCP_UNALIGN, 0); +} + +void QEMU_NORETURN do_unassigned_access(target_phys_addr_t addr, int is_write, + int is_exec, int unused, int size) +{ + env->trap_arg0 = addr; + env->trap_arg1 = is_write; + dynamic_excp(EXCP_MCHK, 0); +} + #define MMUSUFFIX _mmu +#define ALIGNED_ONLY #define SHIFT 0 #include "softmmu_template.h" -- cgit v1.2.3