Skip to content

Conversation

@Dmamss
Copy link

@Dmamss Dmamss commented Jan 4, 2026

No description provided.

@jpd002
Copy link
Owner

jpd002 commented Jan 6, 2026

Nice! How can this be tested?

Dmamss and others added 5 commits January 11, 2026 18:33
fix: remove duplicate code
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.
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