Skip to content

Conversation

@F0bes
Copy link
Member

@F0bes F0bes commented Feb 7, 2025

Credit goes to the Julia language and Dolphin emulator for their free and open source implementations

Description of Changes

Instead of relying on signal handling for our segfault handler, create mach exception ports.

Rationale behind Changes

I was hoping this would allow me to reliably use lldb but it appears that rosetta might still be a blocker.

Suggested Testing Steps

Test games with self modifying code?

@JordanTheToaster JordanTheToaster added this to the Release 2.X milestone May 17, 2025
@F0bes F0bes marked this pull request as ready for review November 2, 2025 20:12
@F0bes F0bes changed the title Darwin: Implement Mach exceptions ports instead of signals Darwin: Implement Mach exception ports instead of signals Nov 2, 2025
@DigitalMajestic
Copy link
Contributor

R&C2 Megaturret uses self modifying code, tested (in this case the Mega Megaturret specifically but they should be identical on the SMC front) and works with this PR on macOS 15 with Apple Silicon

@F0bes F0bes force-pushed the mach-exceptions branch 2 times, most recently from bd2970e to befcca8 Compare November 20, 2025 00:09
Copy link
Contributor

@DigitalMajestic DigitalMajestic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working good.

}

mach_port_t previous;
mach_port_request_notification(mach_task_self(), port, MACH_NOTIFY_NO_SENDERS, 0, port, MACH_MSG_TYPE_MAKE_SEND_ONCE, &previous);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check the result of this call, and also mach_port_deallocate previous if it is not MACH_PORT_NULL

@Mrlinkwii Mrlinkwii modified the milestones: Release 2.6, Release 2.8 Dec 5, 2025
Credit goes to the Julia language and Dolphin emulator for their free and open source implementations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants