mirror of
https://github.com/utmapp/qemu.git
synced 2026-05-26 13:51:06 +00:00
75a3837dfb
On iOS, we cannot allocate RWX pages without special entitlements. As a workaround, we can 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. To better keep track of pointers to RW/RX memory, we mark any tcg_insn_unit pointers as `const` if they will never be written to. We also define a new macro `TCG_CODE_PTR_RW` that returns a pointer to RW memory. Only the difference between the two 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).