aboutsummaryrefslogtreecommitdiff
path: root/target-sparc/mmu_helper.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-08-26 03:01:33 +0200
committerAndreas Färber <afaerber@suse.de>2014-03-13 19:20:46 +0100
commit7510454e3e74aafa2e6c50388bf24904644b6a96 (patch)
treed529c51ffa5633e8e067ae092bbc33bcf9a7bd8f /target-sparc/mmu_helper.c
parent7372c2b926200db295412efbb53f93773b7f1754 (diff)
cpu: Turn cpu_handle_mmu_fault() into a CPUClass hook
Note that while such functions may exist both for *-user and softmmu, only *-user uses the CPUState hook, while softmmu reuses the prototype for calling it directly. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-sparc/mmu_helper.c')
-rw-r--r--target-sparc/mmu_helper.c18
1 files changed, 12 insertions, 6 deletions
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;