diff options
Diffstat (limited to 'target-sparc')
-rw-r--r-- | target-sparc/cpu.c | 4 | ||||
-rw-r--r-- | target-sparc/cpu.h | 3 | ||||
-rw-r--r-- | target-sparc/ldst_helper.c | 3 | ||||
-rw-r--r-- | target-sparc/mmu_helper.c | 18 |
4 files changed, 18 insertions, 10 deletions
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index 9a315c8d4c..3e6e7a754e 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -821,7 +821,9 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->synchronize_from_tb = sparc_cpu_synchronize_from_tb; cc->gdb_read_register = sparc_cpu_gdb_read_register; cc->gdb_write_register = sparc_cpu_gdb_write_register; -#ifndef CONFIG_USER_ONLY +#ifdef CONFIG_USER_ONLY + cc->handle_mmu_fault = sparc_cpu_handle_mmu_fault; +#else cc->do_unassigned_access = sparc_cpu_unassigned_access; cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug; #endif diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index e14b5a12aa..893caa0576 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -521,9 +521,8 @@ SPARCCPU *cpu_sparc_init(const char *cpu_model); void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu); void sparc_cpu_list(FILE *f, fprintf_function cpu_fprintf); /* mmu_helper.c */ -int cpu_sparc_handle_mmu_fault(CPUSPARCState *env1, target_ulong address, int rw, +int sparc_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw, int mmu_idx); -#define cpu_handle_mmu_fault cpu_sparc_handle_mmu_fault target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev); void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env); diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index 45ed154346..c2482454ac 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c @@ -2441,9 +2441,10 @@ static void QEMU_NORETURN do_unaligned_access(CPUSPARCState *env, void tlb_fill(CPUSPARCState *env, target_ulong addr, int is_write, int mmu_idx, uintptr_t retaddr) { + SPARCCPU *cpu = sparc_env_get_cpu(env); int ret; - ret = cpu_sparc_handle_mmu_fault(env, addr, is_write, mmu_idx); + ret = sparc_cpu_handle_mmu_fault(CPU(cpu), addr, is_write, mmu_idx); if (ret) { if (retaddr) { cpu_restore_state(env, retaddr); diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c index 511eb7e65c..5a9748e347 100644 --- a/target-sparc/mmu_helper.c +++ b/target-sparc/mmu_helper.c @@ -25,13 +25,15 @@ #if defined(CONFIG_USER_ONLY) -int cpu_sparc_handle_mmu_fault(CPUSPARCState *env1, target_ulong address, int rw, +int sparc_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw, int mmu_idx) { + SPARCCPU *cpu = SPARC_CPU(cs); + if (rw & 2) { - env1->exception_index = TT_TFAULT; + cpu->env.exception_index = TT_TFAULT; } else { - env1->exception_index = TT_DFAULT; + cpu->env.exception_index = TT_DFAULT; } return 1; } @@ -198,9 +200,11 @@ static int get_physical_address(CPUSPARCState *env, hwaddr *physical, } /* Perform address translation */ -int cpu_sparc_handle_mmu_fault(CPUSPARCState *env, target_ulong address, int rw, +int sparc_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw, int mmu_idx) { + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; hwaddr paddr; target_ulong vaddr; target_ulong page_size; @@ -212,7 +216,7 @@ int cpu_sparc_handle_mmu_fault(CPUSPARCState *env, target_ulong address, int rw, vaddr = address; if (error_code == 0) { #ifdef DEBUG_MMU - printf("Translate at " TARGET_FMT_lx " -> " TARGET_FMT_plx ", vaddr " + printf("Translate at %" VADDR_PRIx " -> " TARGET_FMT_plx ", vaddr " TARGET_FMT_lx "\n", address, paddr, vaddr); #endif tlb_set_page(env, vaddr, paddr, prot, mmu_idx, page_size); @@ -705,9 +709,11 @@ static int get_physical_address(CPUSPARCState *env, hwaddr *physical, } /* Perform address translation */ -int cpu_sparc_handle_mmu_fault(CPUSPARCState *env, target_ulong address, int rw, +int sparc_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw, int mmu_idx) { + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; target_ulong vaddr; hwaddr paddr; target_ulong page_size; |