unicorn-engine / unicorn

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)
http://www.unicorn-engine.org
GNU General Public License v2.0
7.33k stars 1.31k forks source link

Does memory need to be mapped aligned to page boundaries? #1947

Closed Joshua-Schroijen closed 2 months ago

Joshua-Schroijen commented 2 months ago

Hello!
I have a very simple question. A lot of Unicorn code I have been studying seems to make sure the start and end of memory regions to be mapped in the emulator using mem_map() are aligned to page boundaries. Is this necessary or a good idea (and if so, why)? Could failing to do this cause strange behavior?

Is there anything mem_map() explicitly or implicitly requires about its memory addresses to be aware about at all? Or are arbitrary byte-level addresses OK?

Thanks in advance for the input!
Joshua

Joshua-Schroijen commented 2 months ago

Should have posted this in the discussion section, sorry