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:
37
uc.c
37
uc.c
@@ -230,6 +230,11 @@ static uc_err uc_init(uc_engine *uc)
|
||||
return UC_ERR_RESOURCE;
|
||||
}
|
||||
|
||||
// init tlb function
|
||||
if (!uc->cpu->cc->tlb_fill) {
|
||||
uc->set_tlb(uc, UC_TLB_CPU);
|
||||
}
|
||||
|
||||
// init fpu softfloat
|
||||
uc->softfloat_initialize();
|
||||
|
||||
@@ -577,10 +582,6 @@ uc_err uc_mem_read(uc_engine *uc, uint64_t address, void *_bytes, size_t size)
|
||||
if (size > INT_MAX)
|
||||
return UC_ERR_ARG;
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
if (!check_mem_area(uc, address, size)) {
|
||||
return UC_ERR_READ_UNMAPPED;
|
||||
}
|
||||
@@ -622,10 +623,6 @@ uc_err uc_mem_write(uc_engine *uc, uint64_t address, const void *_bytes,
|
||||
if (size > INT_MAX)
|
||||
return UC_ERR_ARG;
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
if (!check_mem_area(uc, address, size)) {
|
||||
return UC_ERR_WRITE_UNMAPPED;
|
||||
}
|
||||
@@ -1039,10 +1036,6 @@ uc_err uc_mem_map(uc_engine *uc, uint64_t address, size_t size, uint32_t perms)
|
||||
|
||||
UC_INIT(uc);
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
res = mem_map_check(uc, address, size, perms);
|
||||
if (res) {
|
||||
return res;
|
||||
@@ -1063,10 +1056,6 @@ uc_err uc_mem_map_ptr(uc_engine *uc, uint64_t address, size_t size,
|
||||
return UC_ERR_ARG;
|
||||
}
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
res = mem_map_check(uc, address, size, perms);
|
||||
if (res) {
|
||||
return res;
|
||||
@@ -1084,10 +1073,6 @@ uc_err uc_mmio_map(uc_engine *uc, uint64_t address, size_t size,
|
||||
|
||||
UC_INIT(uc);
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
res = mem_map_check(uc, address, size, UC_PROT_ALL);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -1387,10 +1372,6 @@ uc_err uc_mem_protect(struct uc_struct *uc, uint64_t address, size_t size,
|
||||
return UC_ERR_ARG;
|
||||
}
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
// check that user's entire requested block is mapped
|
||||
if (!check_mem_area(uc, address, size)) {
|
||||
return UC_ERR_NOMEM;
|
||||
@@ -1467,10 +1448,6 @@ uc_err uc_mem_unmap(struct uc_struct *uc, uint64_t address, size_t size)
|
||||
return UC_ERR_ARG;
|
||||
}
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
// check that user's entire requested block is mapped
|
||||
if (!check_mem_area(uc, address, size)) {
|
||||
return UC_ERR_NOMEM;
|
||||
@@ -1515,10 +1492,6 @@ MemoryRegion *find_memory_region(struct uc_struct *uc, uint64_t address)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (uc->mem_redirect) {
|
||||
address = uc->mem_redirect(address);
|
||||
}
|
||||
|
||||
// try with the cache index first
|
||||
i = uc->mapped_block_cache_index;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user