mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
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>
This commit is contained in:
parent
7372c2b926
commit
7510454e3e
61 changed files with 238 additions and 151 deletions
|
@ -165,7 +165,9 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
|
|||
cc->set_pc = openrisc_cpu_set_pc;
|
||||
cc->gdb_read_register = openrisc_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = openrisc_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
cc->handle_mmu_fault = openrisc_cpu_handle_mmu_fault;
|
||||
#else
|
||||
cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_openrisc_cpu;
|
||||
#endif
|
||||
|
|
|
@ -353,15 +353,13 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
|||
int openrisc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
int openrisc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
void openrisc_translate_init(void);
|
||||
int cpu_openrisc_handle_mmu_fault(CPUOpenRISCState *env,
|
||||
target_ulong address,
|
||||
int openrisc_cpu_handle_mmu_fault(CPUState *cpu, vaddr address,
|
||||
int rw, int mmu_idx);
|
||||
int cpu_openrisc_signal_handler(int host_signum, void *pinfo, void *puc);
|
||||
|
||||
#define cpu_list cpu_openrisc_list
|
||||
#define cpu_exec cpu_openrisc_exec
|
||||
#define cpu_gen_code cpu_openrisc_gen_code
|
||||
#define cpu_handle_mmu_fault cpu_openrisc_handle_mmu_fault
|
||||
#define cpu_signal_handler cpu_openrisc_signal_handler
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
|
|
@ -174,19 +174,19 @@ static void cpu_openrisc_raise_mmu_exception(OpenRISCCPU *cpu,
|
|||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
int cpu_openrisc_handle_mmu_fault(CPUOpenRISCState *env,
|
||||
target_ulong address, int rw, int mmu_idx)
|
||||
int openrisc_cpu_handle_mmu_fault(CPUState *cs,
|
||||
vaddr address, int rw, int mmu_idx)
|
||||
{
|
||||
OpenRISCCPU *cpu = OPENRISC_CPU(cs);
|
||||
int ret = 0;
|
||||
hwaddr physical = 0;
|
||||
int prot = 0;
|
||||
OpenRISCCPU *cpu = openrisc_env_get_cpu(env);
|
||||
|
||||
ret = cpu_openrisc_get_phys_addr(cpu, &physical, &prot,
|
||||
address, rw);
|
||||
|
||||
if (ret == TLBRET_MATCH) {
|
||||
tlb_set_page(env, address & TARGET_PAGE_MASK,
|
||||
tlb_set_page(&cpu->env, address & TARGET_PAGE_MASK,
|
||||
physical & TARGET_PAGE_MASK, prot,
|
||||
mmu_idx, TARGET_PAGE_SIZE);
|
||||
ret = 0;
|
||||
|
@ -198,11 +198,11 @@ int cpu_openrisc_handle_mmu_fault(CPUOpenRISCState *env,
|
|||
return ret;
|
||||
}
|
||||
#else
|
||||
int cpu_openrisc_handle_mmu_fault(CPUOpenRISCState *env,
|
||||
target_ulong address, int rw, int mmu_idx)
|
||||
int openrisc_cpu_handle_mmu_fault(CPUState *cs,
|
||||
vaddr address, int rw, int mmu_idx)
|
||||
{
|
||||
OpenRISCCPU *cpu = OPENRISC_CPU(cs);
|
||||
int ret = 0;
|
||||
OpenRISCCPU *cpu = openrisc_env_get_cpu(env);
|
||||
|
||||
cpu_openrisc_raise_mmu_exception(cpu, address, rw, ret);
|
||||
ret = 1;
|
||||
|
|
|
@ -39,9 +39,10 @@
|
|||
void tlb_fill(CPUOpenRISCState *env, target_ulong addr, int is_write,
|
||||
int mmu_idx, uintptr_t retaddr)
|
||||
{
|
||||
OpenRISCCPU *cpu = openrisc_env_get_cpu(env);
|
||||
int ret;
|
||||
|
||||
ret = cpu_openrisc_handle_mmu_fault(env, addr, is_write, mmu_idx);
|
||||
ret = openrisc_cpu_handle_mmu_fault(CPU(cpu), addr, is_write, mmu_idx);
|
||||
|
||||
if (ret) {
|
||||
if (retaddr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue