Skip to content

Commit

Permalink
target-ppc: Use PowerPCCPU in PowerPCCPUClass::handle_mmu_fault hook
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Mar 13, 2014
1 parent 611d4f9 commit d0e39c5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
8 changes: 5 additions & 3 deletions target-ppc/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#define POWERPC_CPU_GET_CLASS(obj) \
OBJECT_GET_CLASS(PowerPCCPUClass, (obj), TYPE_POWERPC_CPU)

typedef struct PowerPCCPU PowerPCCPU;

/**
* PowerPCCPUClass:
* @parent_realize: The parent class' realize handler.
Expand Down Expand Up @@ -71,7 +73,7 @@ typedef struct PowerPCCPUClass {
void (*init_proc)(CPUPPCState *env);
int (*check_pow)(CPUPPCState *env);
#if defined(CONFIG_SOFTMMU)
int (*handle_mmu_fault)(CPUPPCState *env, target_ulong eaddr, int rwx,
int (*handle_mmu_fault)(PowerPCCPU *cpu, target_ulong eaddr, int rwx,
int mmu_idx);
#endif
} PowerPCCPUClass;
Expand All @@ -83,14 +85,14 @@ typedef struct PowerPCCPUClass {
*
* A PowerPC CPU.
*/
typedef struct PowerPCCPU {
struct PowerPCCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUPPCState env;
int cpu_dt_id;
} PowerPCCPU;
};

static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
{
Expand Down
5 changes: 3 additions & 2 deletions target-ppc/mmu-hash32.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,11 @@ static hwaddr ppc_hash32_pte_raddr(target_ulong sr, ppc_hash_pte32_t pte,
return (rpn & ~mask) | (eaddr & mask);
}

int ppc_hash32_handle_mmu_fault(CPUPPCState *env, target_ulong eaddr, int rwx,
int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr, int rwx,
int mmu_idx)
{
CPUState *cs = CPU(ppc_env_get_cpu(env));
CPUState *cs = CPU(cpu);
CPUPPCState *env = &cpu->env;
target_ulong sr;
hwaddr pte_offset;
ppc_hash_pte32_t pte;
Expand Down
2 changes: 1 addition & 1 deletion target-ppc/mmu-hash32.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

hwaddr get_pteg_offset32(CPUPPCState *env, hwaddr hash);
hwaddr ppc_hash32_get_phys_page_debug(CPUPPCState *env, target_ulong addr);
int ppc_hash32_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw,
int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, target_ulong address, int rw,
int mmu_idx);

/*
Expand Down
5 changes: 3 additions & 2 deletions target-ppc/mmu-hash64.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,11 @@ static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte,
return (rpn & ~mask) | (eaddr & mask);
}

int ppc_hash64_handle_mmu_fault(CPUPPCState *env, target_ulong eaddr,
int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr,
int rwx, int mmu_idx)
{
CPUState *cs = CPU(ppc_env_get_cpu(env));
CPUState *cs = CPU(cpu);
CPUPPCState *env = &cpu->env;
ppc_slb_t *slb;
hwaddr pte_offset;
ppc_hash_pte64_t pte;
Expand Down
2 changes: 1 addition & 1 deletion target-ppc/mmu-hash64.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
void dump_slb(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env);
int ppc_store_slb (CPUPPCState *env, target_ulong rb, target_ulong rs);
hwaddr ppc_hash64_get_phys_page_debug(CPUPPCState *env, target_ulong addr);
int ppc_hash64_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw,
int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong address, int rw,
int mmu_idx);
void ppc_hash64_store_hpte(CPUPPCState *env, target_ulong index,
target_ulong pte0, target_ulong pte1);
Expand Down
2 changes: 1 addition & 1 deletion target-ppc/mmu_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2902,7 +2902,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,
int ret;

if (pcc->handle_mmu_fault) {
ret = pcc->handle_mmu_fault(env, addr, is_write, mmu_idx);
ret = pcc->handle_mmu_fault(cpu, addr, is_write, mmu_idx);
} else {
ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, mmu_idx);
}
Expand Down

0 comments on commit d0e39c5

Please sign in to comment.