mirror of
https://github.com/utmapp/qemu.git
synced 2026-05-26 13:51:06 +00:00
e461c3762a
On iOS, we cannot allocate RWX pages without special entitlements. As a workaround, we can allocate a RX region and then mirror map it to a separate RX region. Then we can write to one region and execute from the other one. We also define `tcg_mirror_ptr_rw` and `tcg_code_ptr_rw` to return a pointer to RW memory. The difference between the RW and RX regions is stored in the TCG context. To ensure cache coherency, we flush the data cache in the RW mapping and then invalidate the instruction cache in the RX mapping (where applicable). Because data cache flush is OS defined on some architectures, we do not provide implementations for non iOS platforms (ARM/x86).