Repository navigation
osdlib_retro: flush the instruction cache on macOS - #580
Merged
Merged
Conversation
invalidate_instruction_cache skipped the flush under !defined(TARGET_OS_IPHONE). Apple's TargetConditionals.h DEFINES TARGET_OS_IPHONE as 0 on macOS, so the guard was false there and Apple Silicon ran stale code in recompiler output: the first hng64 build died with SIGILL on a valid instruction (movz x14,#0x4f10). Test the macro's value, not its presence. Control: the unpatched build crashes on the same run; patched, sams64 and xrally run 1800 frames with the same distinct-frame counts as the buildbot's full core.
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.
invalidate_instruction_cacheskips the cache flush under!defined(TARGET_OS_IPHONE), but Apple'sTargetConditionals.hdefinesTARGET_OS_IPHONEas0on macOS — so the guard is false there and the flush never runs. On Apple Silicon, recompiler output can then execute stale: an arm64platform=osxbuild of thehng64driver died withSIGILLon a valid instruction on first run.Fix: test the macro's value, not its presence. iOS is unchanged.
Verified: unpatched crashes on the same run; patched,
sams64andxrallyrun 1800 frames matching the buildbot core.(Reopening — I closed this by accident while tidying branches. Patch is unchanged.)