Fix native macOS arm64 dynarec support#631
Open
resvel wants to merge 3 commits into
Open
Conversation
Narrow RI and RSP register index masks from 0xffff to the correct bit widths (0x1f / 0x7), preventing out-of-range array indexing. Add explicit bounds checks in rdram read/write paths so out-of-range register accesses emit a warning and return safely instead of crashing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes native Apple Silicon macOS dynarec support when building Mupen64Plus-Next with the aarch64 dynarec.
Problem
On native macOS arm64, the dynamic recompiler could crash or jump through corrupted trampoline/register state. The dynarec also needed a working macOS JIT memory path using MAP_JIT.
Changes
Testing
Built locally on Apple Silicon macOS:
This completed successfully and produced an arm64
mupen64plus_next_libretro.dylib.Compatibility
The macOS-specific JIT behavior is guarded to macOS/arm64 paths. Non-macOS behavior should be unchanged except for the bounds/masking safety checks.