Remove MMU hacks
Unicorn has included some ugly hacks to provide a envirement where vaddr == paddr. These hacks where to use the full 64 bit mappings on x86 without init the mmu and some memory redirect for MIPS. The UC_TLB_CPU mode defaults to vaddr == paddr, therfor these hacks aren't required anymore.
This commit is contained in:
@@ -2080,7 +2080,6 @@ void arm_cpu_class_init(struct uc_struct *uc, CPUClass *oc)
|
||||
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
|
||||
cc->asidx_from_attrs = arm_asidx_from_attrs;
|
||||
cc->tcg_initialize = arm_translate_init;
|
||||
cc->tlb_fill = arm_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = arm_cpu_tlb_fill;
|
||||
cc->debug_excp_handler = arm_debug_excp_handler;
|
||||
cc->do_unaligned_access = arm_cpu_do_unaligned_access;
|
||||
|
||||
@@ -5066,7 +5066,6 @@ static void x86_cpu_common_class_init(struct uc_struct *uc, CPUClass *oc, void *
|
||||
cc->cpu_exec_enter = x86_cpu_exec_enter;
|
||||
cc->cpu_exec_exit = x86_cpu_exec_exit;
|
||||
cc->tcg_initialize = tcg_x86_init;
|
||||
cc->tlb_fill = x86_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = x86_cpu_tlb_fill;
|
||||
}
|
||||
|
||||
|
||||
@@ -635,12 +635,7 @@ do_check_protect_pse36:
|
||||
/* align to page_size */
|
||||
pte &= PG_ADDRESS_MASK & ~(page_size - 1);
|
||||
page_offset = addr & (page_size - 1);
|
||||
/* HACK allow full 64 bit mapping in u64 without paging */
|
||||
if (env->cr[0] & CR0_PG_MASK) {
|
||||
paddr = get_hphys(cs, pte + page_offset, is_write1, &prot);
|
||||
} else {
|
||||
paddr = addr;
|
||||
}
|
||||
paddr = get_hphys(cs, pte + page_offset, is_write1, &prot);
|
||||
|
||||
/* Even if 4MB pages, we map only one 4KB page in the cache to
|
||||
avoid filling it too fast */
|
||||
|
||||
@@ -231,7 +231,6 @@ static void m68k_cpu_class_init(CPUClass *c)
|
||||
cc->do_interrupt = m68k_cpu_do_interrupt;
|
||||
cc->cpu_exec_interrupt = m68k_cpu_exec_interrupt;
|
||||
cc->set_pc = m68k_cpu_set_pc;
|
||||
cc->tlb_fill = m68k_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = m68k_cpu_tlb_fill;
|
||||
cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
|
||||
cc->tcg_initialize = m68k_tcg_init;
|
||||
|
||||
@@ -147,7 +147,6 @@ static void mips_cpu_class_init(CPUClass *c)
|
||||
cc->do_unaligned_access = mips_cpu_do_unaligned_access;
|
||||
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
|
||||
cc->tcg_initialize = mips_tcg_init;
|
||||
cc->tlb_fill = mips_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = mips_cpu_tlb_fill;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,21 +17,6 @@ typedef uint32_t mipsreg_t;
|
||||
|
||||
MIPSCPU *cpu_mips_init(struct uc_struct *uc);
|
||||
|
||||
static uint64_t mips_mem_redirect(uint64_t address)
|
||||
{
|
||||
// kseg0 range masks off high address bit
|
||||
if (address >= 0x80000000 && address <= 0x9fffffff)
|
||||
return address & 0x7fffffff;
|
||||
|
||||
// kseg1 range masks off top 3 address bits
|
||||
if (address >= 0xa0000000 && address <= 0xbfffffff) {
|
||||
return address & 0x1fffffff;
|
||||
}
|
||||
|
||||
// no redirect
|
||||
return address;
|
||||
}
|
||||
|
||||
static void mips_set_pc(struct uc_struct *uc, uint64_t address)
|
||||
{
|
||||
((CPUMIPSState *)uc->cpu->env_ptr)->active_tc.PC = address;
|
||||
@@ -272,7 +257,6 @@ void mipsel_uc_init(struct uc_struct *uc)
|
||||
uc->release = mips_release;
|
||||
uc->set_pc = mips_set_pc;
|
||||
uc->get_pc = mips_get_pc;
|
||||
uc->mem_redirect = mips_mem_redirect;
|
||||
uc->cpus_init = mips_cpus_init;
|
||||
uc->cpu_context_size = offsetof(CPUMIPSState, end_reset_fields);
|
||||
uc_common_init(uc);
|
||||
|
||||
@@ -10253,7 +10253,6 @@ static void ppc_cpu_class_init(struct uc_struct *uc, CPUClass *oc)
|
||||
cc->do_unaligned_access = ppc_cpu_do_unaligned_access;
|
||||
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
|
||||
cc->tcg_initialize = ppc_translate_init;
|
||||
cc->tlb_fill = ppc_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = ppc_cpu_tlb_fill;
|
||||
cc->cpu_exec_enter = ppc_cpu_exec_enter;
|
||||
cc->cpu_exec_exit = ppc_cpu_exec_exit;
|
||||
|
||||
@@ -77,21 +77,6 @@ static inline int uc_ppc_store_msr(CPUPPCState *env, target_ulong value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint64_t ppc_mem_redirect(uint64_t address)
|
||||
{
|
||||
/* // kseg0 range masks off high address bit
|
||||
if (address >= 0x80000000 && address <= 0x9fffffff)
|
||||
return address & 0x7fffffff;
|
||||
|
||||
// kseg1 range masks off top 3 address bits
|
||||
if (address >= 0xa0000000 && address <= 0xbfffffff) {
|
||||
return address & 0x1fffffff;
|
||||
}*/
|
||||
|
||||
// no redirect
|
||||
return address;
|
||||
}
|
||||
|
||||
static void ppc_set_pc(struct uc_struct *uc, uint64_t address)
|
||||
{
|
||||
((CPUPPCState *)uc->cpu->env_ptr)->nip = address;
|
||||
@@ -435,7 +420,6 @@ void ppc_uc_init(struct uc_struct *uc)
|
||||
uc->release = ppc_release;
|
||||
uc->set_pc = ppc_set_pc;
|
||||
uc->get_pc = ppc_get_pc;
|
||||
uc->mem_redirect = ppc_mem_redirect;
|
||||
uc->cpus_init = ppc_cpus_init;
|
||||
uc->cpu_context_size = offsetof(CPUPPCState, uc);
|
||||
uc_common_init(uc);
|
||||
|
||||
@@ -307,7 +307,6 @@ static void riscv_cpu_class_init(struct uc_struct *uc, CPUClass *c, void *data)
|
||||
cc->synchronize_from_tb = riscv_cpu_synchronize_from_tb;
|
||||
cc->do_unaligned_access = riscv_cpu_do_unaligned_access;
|
||||
cc->tcg_initialize = riscv_translate_init;
|
||||
cc->tlb_fill = riscv_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = riscv_cpu_tlb_fill;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,6 @@ static void s390_cpu_class_init(struct uc_struct *uc, CPUClass *oc)
|
||||
cc->debug_excp_handler = s390x_cpu_debug_excp_handler;
|
||||
cc->do_unaligned_access = s390x_cpu_do_unaligned_access;
|
||||
cc->tcg_initialize = s390x_translate_init;
|
||||
cc->tlb_fill = s390_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = s390_cpu_tlb_fill;
|
||||
|
||||
// s390_cpu_model_class_register_props(oc);
|
||||
|
||||
@@ -504,7 +504,6 @@ static void sparc_cpu_class_init(struct uc_struct *uc, CPUClass *oc)
|
||||
cc->cpu_exec_interrupt = sparc_cpu_exec_interrupt;
|
||||
cc->set_pc = sparc_cpu_set_pc;
|
||||
cc->synchronize_from_tb = sparc_cpu_synchronize_from_tb;
|
||||
cc->tlb_fill = sparc_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = sparc_cpu_tlb_fill;
|
||||
cc->do_unaligned_access = sparc_cpu_do_unaligned_access;
|
||||
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
|
||||
|
||||
@@ -137,7 +137,6 @@ static void tricore_cpu_class_init(CPUClass *c)
|
||||
cc->synchronize_from_tb = tricore_cpu_synchronize_from_tb;
|
||||
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
|
||||
|
||||
cc->tlb_fill = tricore_cpu_tlb_fill;
|
||||
cc->tlb_fill_cpu = tricore_cpu_tlb_fill;
|
||||
cc->tcg_initialize = tricore_tcg_init;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user