New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(x86) Emulated CPU is not translating virtual memory addresses #947

StrikerX3 opened this Issue Feb 24, 2018 · 1 comment


None yet
2 participants
Copy link

StrikerX3 commented Feb 24, 2018

The emulated CPU does not translate memory addresses after setting up paging correctly. The two tests related to paging (here) are skipped; they fail if enabled.

I also tried using uc_map_mem_ptr with a char[] already containing the PDEs, PTEs, code and data, then prepared the CPU registers, protected mode, MTRRs and PAT with uc_reg_write and tried to run only the last part of the code where it reads from the virtual address. This fails too. If I manually translate the address using the data existing on the memory and CR3 register at the end of emulation, I can fetch the correct value.

If the CPU tries to read, write or execute code that was not previously mapped with uc_mem_map or uc_mem_map_ptr, uc_emu_start returns one of UC_ERR_READ_UNMAPPED, UC_ERR_WRITE_UNMAPPED or UC_ERR_FETCH_UNMAPPED, depending on what happened. I believe #439 is related to this.

I built Unicorn from master with MSYS2 / MinGW32 and MinGW64 on Windows 10 and with the default C++ toolchain on Ubuntu 16.04.3.


This comment has been minimized.

Copy link

aut0 commented Nov 29, 2018

This happens in arm64 as well. Is this a bug or is virtual memory just unsupported? It looks like the code that checks for mapped memory just doesn't care if the address is virtual. Maybe adding a hook and just returning true if the address is virtual is enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment