Uses Copy on Write to make it posible to restore the memory state after a snapshot
was made. To restore all MemoryRegions created after the snapshot are removed.
We still need this API because the virtual memory address space of
32 bits os is only 4GB and we default need 1G per instance
Credits to @ZehMatt for original idea
Co-authored-by: ζeh Matt <5415177+ZehMatt@users.noreply.github.com>
Consider this case:
t:inc ecx,
inc edx,
jmp t
It would generate exactly one block and TB chain will generate an inline
jump. If we don't check exit at the entry of the block, we will never be
terminated.
This test case is recorded in the commit message since it's a bit
painful to write multithread related code that builds on all platforms.
`Could not allocate dynamic translator buffer` error while
trying to perform any memory-related operation.
This happens on aarch64 (MacBook Pro M1)
Solution: ensure aarch64 architecture is properly checked against
Fixes#1556
1. Add cmake support in CMakeLists.txt according to https://developer.android.com/ndk/guides/other_build_systems
2. Resolve symbols errors
3. Backport fixes from 438ed42311
> QEMU relies on two optimization for ppc64 and arm:
>
> 1. if(0) /* optimized code */
> 2. assert(0); /* optimized code */
>
> But the assert on mingw32 doesn't have noreturn attribute which prevents
> the second optimization and some code is reverted to the original code
> to fit in the first optimization.
>
> The assert implementation is copied from glib as qemu did.
Unfortunately, NDK also doesn't have an assert implementation qemu prefers.
* Add setjmp wrapper
* Add to projects
* Use wrapper on x64
* Always build on x64 and exclude on win32
* Fix signature
* Add comments
* Add comments for os-win32.h
* Add extern decleration
* Support cmake Windows build
* Fix for MinGW
When unicorn and systemd are combined into a single binary the 2
libraries conflict on bitmap_set and bitmap_clear functions which breaks
unicorn.
Co-authored-by: Nicolae Mogoreanu <mogo@google.com>