Based-on: 20201026191540.12434-...@getutm.app ([PATCH RESEND 0/4] Mirror map JIT memory for TCG)
These set of changes brings QEMU TCG to iOS devices and future Apple Silicon devices. They were originally developed last year and have been working in the UTM app. Recently, we ported the changes to master, re-wrote a lot of the build script changes for meson, and broke up the patches into more distinct units. A summary of the changes: * `CONFIG_IOS` defined when building for iOS and iOS specific changes (as well as unsupported code) are gated behind it. * A new dependency, libucontext is added since iOS does not have native ucontext and broken support for sigaltstack. libucontext is available as a new option for coroutine backend. * On stock iOS devices, there is a workaround for running JIT code without any special entitlement. It requires the JIT region to be mirror mapped with one region RW and another one RX. To support this style of JIT, TCG is changed to support writing to a different code_ptr. This change is submitted in a different patch set and this one depends on it. * For (recent) jailbroken iOS devices as well as upcoming Apple Silicon devices, there are new rules for applications supporting JIT (with the proper entitlement). These rules are implemented as well. Since v3: * Moved mirror JIT support to a different patch set. * Removed dependency on `pthread_jit_write_protect_np` because it was redundent and also crashes if called on a non-jailbroken iOS device. * Removed `--enable-cross-compile` option * Fixed checkpatch errors * Fixed iOS build on master due to new test recently added which calls system() Since v2: * Changed getting mirror pointer from a macro to inline functions * Split constification of TCG code pointers to separate patch * Removed slirp updates (will send future patch once slirp changes are in) * Removed shared library patch (will send future patch) -j Joelle van Dyne (7): configure: option to disable host block devices configure: cross-compiling with empty cross_prefix qemu: add support for iOS host coroutine: add libucontext as external library slirp: update build flags for iOS resolv fix tcg: implement JIT for iOS and Apple Silicon block: check availablity for preadv/pwritev on mac docs/devel/index.rst | 1 + docs/devel/ios.rst | 39 ++++++++++++ configure | 77 ++++++++++++++++++++++-- meson.build | 34 ++++++++++- include/exec/exec-all.h | 2 + include/tcg/tcg-apple-jit.h | 106 +++++++++++++++++++++++++++++++++ include/tcg/tcg.h | 3 + tcg/aarch64/tcg-target.h | 7 +++ accel/tcg/cpu-exec-common.c | 2 + accel/tcg/cpu-exec.c | 2 + accel/tcg/translate-all.c | 87 ++++++++++++++++++++++++++- block.c | 2 +- block/file-posix.c | 51 ++++++++++++---- net/slirp.c | 16 ++--- qga/commands-posix.c | 6 ++ target/arm/arm-semi.c | 2 + target/m68k/m68k-semi.c | 2 + target/nios2/nios2-semi.c | 2 + tcg/tcg.c | 4 ++ tests/qtest/libqos/virtio-9p.c | 8 +++ util/coroutine-ucontext.c | 9 +++ .gitmodules | 3 + libucontext | 1 + meson_options.txt | 2 + tests/qtest/meson.build | 7 +-- 25 files changed, 440 insertions(+), 35 deletions(-) create mode 100644 docs/devel/ios.rst create mode 100644 include/tcg/tcg-apple-jit.h create mode 160000 libucontext -- 2.28.0