Open Antelox opened 2 months ago
Setting it to VIRTUAL solves the issue but I'm not totally sure if this is proper fix or just a side effect.
Yes this is the proper fix.
With this release unicorn enables the softmmu of qemu and defaults to the mmu of the emulated target. By default the mmu of X86 only allows access to a limit part of the address space. To use the full virtual address space you can either configure the mmu of your emulation target or use the virtual mmu with by default does a 1:1 mapping.
~Quick debugging shows that we by default don't enable long mode, which is the root cause.~
The root cause is that, long mode is enabled while paging is disabled. This is indeed resulting a 1:1 mapping but note x86_64 only supports 52 bits of physical memory space while the address you are accessing is 54 bits. Therefore, it's a limitation of x86_64 MMU implementation.
I tried to simply extend the mask to 64bits (physical memory address) and this works, but I have no idea if this has further side effects. The best workaround so far is using a lower address or vtlb mode as said above.
Hi, Thanks a lot to both of you for the explanation! In short I need to enable the VIRTUAL mode as reported in my first comment. I will do it and report issues, should I find any of them (Hopefully not :P ), so far so good.
Hi,
Since the 2.1.0 release, I've been observing a crash happening while using very high virtual addresses.
Below a snippet that reproduces the issue:
The crash is this:
unicorn.unicorn_py3.unicorn.UcError: Invalid memory read (UC_ERR_READ_UNMAPPED)
The same code works fine with the version 2.0.1.post1
Digging among the many changes from a release to the other, I have seen the introduction of a
uc_ctl
calledTLB_MODE
(https://github.com/unicorn-engine/unicorn/blob/master/docs/FAQ.md#is-there-anyway-to-disable-softmmu-to-speed-up-execution).Setting it to VIRTUAL solves the issue but I'm not totally sure if this is proper fix or just a side effect.
Any ideas? Thanks in advance!