Skip to content

Conversation

@Dmamss
Copy link
Owner

@Dmamss Dmamss commented Jan 18, 2026

No description provided.

claude and others added 2 commits January 18, 2026 08:49
Implements comprehensive JIT support for iOS with three operating modes:

- Legacy mode (iOS < 26): Toggle W^X using mprotect()
- LuckNoTXM mode (iOS 26+ without TXM): RW/RX mirrors per allocation via vm_remap()
- LuckTXM mode (iOS 26+ with TXM): Pre-allocated 512MB region with lwmem allocator

Changes:
- Added lwmem submodule for dynamic memory management in LuckTXM mode
- Created MemoryUtil.h public API with AllocateExecutableMemory/FreeExecutableMemory
- Implemented dispatcher (MemoryUtil_iOS.cpp) to route calls based on JIT type
- Created mode-specific implementations:
  * MemoryUtil_iOS_Legacy.cpp - mprotect() toggle for iOS < 26
  * MemoryUtil_iOS_LuckNoTXM.cpp - Per-allocation vm_remap() for iOS 26+
  * MemoryUtil_iOS_LuckTXM.cpp - 512MB pre-allocated region with TXM support
- Added JITMemoryTracker for thread-safe region tracking in Legacy mode
- Updated CMakeLists.txt to conditionally build iOS files and link lwmem

Architecture:
- Modular design allows runtime selection of JIT mode via SetJitType()
- LuckTXM uses ARM64 breakpoint instruction (brk #0x69) to signal TXM
- All modes provide clean separation between readable-executable (RX) and
  readable-writable (RW) memory regions as required by iOS security model

Based on Dolphin iOS JIT implementation adapted for Play! PS2 Emulator.
@Dmamss Dmamss merged commit ef129a6 into master Jan 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants