x86: identity map guest address to host address. this fixes issue #300

This commit is contained in:
Nguyen Anh Quynh 2015-12-24 09:51:17 +08:00
parent 8a29acd0de
commit ed319bda0b
3 changed files with 11 additions and 2 deletions

View File

@ -238,8 +238,7 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
uc, UC_MEM_READ_PROT, addr, DATA_SIZE, 0,
uc->hook_callbacks[uc->hook_mem_read_prot_idx].user_data)) {
env->invalid_error = UC_ERR_OK;
}
else {
} else {
env->invalid_addr = addr;
env->invalid_error = UC_ERR_READ_PROT;
// printf("***** Invalid memory read (non-readable) at " TARGET_FMT_lx "\n", addr);

View File

@ -764,6 +764,8 @@ do_check_protect_pse36:
}
}
do_mapping:
#if 0
pte = pte & env->a20_mask;
/* align to page_size */
@ -774,6 +776,12 @@ do_check_protect_pse36:
vaddr = addr & TARGET_PAGE_MASK;
page_offset = vaddr & (page_size - 1);
paddr = pte + page_offset;
#endif
// Unicorn: indentity map guest virtual address to host virtual address
vaddr = addr & TARGET_PAGE_MASK;
paddr = vaddr;
//printf(">>> map address %"PRIx64" to %"PRIx64"\n", vaddr, paddr);
tlb_set_page(cs, vaddr, paddr, prot, mmu_idx, page_size);
return 0;

View File

@ -19,6 +19,8 @@ test: ${ALL_TESTS}
./test_sanity
./test_x86
./test_mem_map
./test_mem_map_ptr
./test_mem_high
test_sanity: test_sanity.c
test_x86: test_x86.c