diff options
author | Andreas Färber <afaerber@suse.de> | 2013-05-27 06:49:53 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-06-28 13:25:13 +0200 |
commit | c658b94f6e8c206c59d02aa6fbac285b86b53d2c (patch) | |
tree | 100efd8e543a576daa8d7dc6684ce1154ea08245 /target-sparc | |
parent | ce927ed9e40e25008453eb8f130661514b633341 (diff) |
cpu: Turn cpu_unassigned_access() into a CPUState hook
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 <afaerber@suse.de>
Diffstat (limited to 'target-sparc')
-rw-r--r-- | target-sparc/cpu.c | 1 | ||||
-rw-r--r-- | target-sparc/cpu.h | 5 | ||||
-rw-r--r-- | target-sparc/ldst_helper.c | 27 |
3 files changed, 23 insertions, 10 deletions
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index ff1200c310..65ae6f73bf 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -771,6 +771,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->do_interrupt = sparc_cpu_do_interrupt; cc->dump_state = sparc_cpu_dump_state; + cpu_class_set_do_unassigned_access(cc, sparc_cpu_unassigned_access); } static const TypeInfo sparc_cpu_type_info = { diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 6fa77789cd..021eb157b6 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -582,8 +582,9 @@ static inline int tlb_compare_context(const SparcTLBEntry *tlb, /* cpu-exec.c */ #if !defined(CONFIG_USER_ONLY) -void cpu_unassigned_access(CPUSPARCState *env1, hwaddr addr, - int is_write, int is_exec, int is_asi, int size); +void sparc_cpu_unassigned_access(CPUState *cpu, hwaddr addr, + bool is_write, bool is_exec, int is_asi, + unsigned size); #if defined(TARGET_SPARC64) hwaddr cpu_get_phys_page_nofault(CPUSPARCState *env, target_ulong addr, int mmu_idx); diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index 6d767fb45a..2936b58b31 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c @@ -686,7 +686,8 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong addr, int asi, int size, break; case 8: /* User code access, XXX */ default: - cpu_unassigned_access(env, addr, 0, 0, asi, size); + cpu_unassigned_access(CPU(sparc_env_get_cpu(env)), + addr, false, false, asi, size); ret = 0; break; } @@ -1088,7 +1089,8 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val, int asi, case 8: /* User code access, XXX */ case 9: /* Supervisor code access, XXX */ default: - cpu_unassigned_access(env, addr, 1, 0, asi, size); + cpu_unassigned_access(CPU(sparc_env_get_cpu(env)), + addr, true, false, asi, size); break; } #ifdef DEBUG_ASI @@ -1594,7 +1596,8 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong addr, int asi, int size, case 0x5f: /* D-MMU demap, WO */ case 0x77: /* Interrupt vector, WO */ default: - cpu_unassigned_access(env, addr, 0, 0, 1, size); + cpu_unassigned_access(CPU(sparc_env_get_cpu(env)), + addr, false, false, 1, size); ret = 0; break; } @@ -2027,7 +2030,8 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, case 0x8a: /* Primary no-fault LE, RO */ case 0x8b: /* Secondary no-fault LE, RO */ default: - cpu_unassigned_access(env, addr, 1, 0, 1, size); + cpu_unassigned_access(CPU(sparc_env_get_cpu(env)), + addr, true, false, 1, size); return; } } @@ -2322,9 +2326,12 @@ void helper_stqf(CPUSPARCState *env, target_ulong addr, int mem_idx) #if !defined(CONFIG_USER_ONLY) #ifndef TARGET_SPARC64 -void cpu_unassigned_access(CPUSPARCState *env, hwaddr addr, - int is_write, int is_exec, int is_asi, int size) +void sparc_cpu_unassigned_access(CPUState *cs, hwaddr addr, + bool is_write, bool is_exec, int is_asi, + unsigned size) { + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; int fault_type; #ifdef DEBUG_UNASSIGNED @@ -2382,9 +2389,13 @@ void cpu_unassigned_access(CPUSPARCState *env, hwaddr addr, } } #else -void cpu_unassigned_access(CPUSPARCState *env, hwaddr addr, - int is_write, int is_exec, int is_asi, int size) +void sparc_cpu_unassigned_access(CPUState *cs, hwaddr addr, + bool is_write, bool is_exec, int is_asi, + unsigned size) { + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; + #ifdef DEBUG_UNASSIGNED printf("Unassigned mem access to " TARGET_FMT_plx " from " TARGET_FMT_lx "\n", addr, env->pc); |