This is an experimental project that modifies Apple's Rosetta technology to use less precise but significantly faster x87 instruction handlers.
On recent macOS, the upstream loader crashed the Rosetta'd target with SIGTRAP
the instant it detached, so acceleration never ran (worked on older releases). The
cause is that PT_DETACH from a breakpoint stop redelivers the stop's pending
SIGTRAP to the now-untraced child. This fork changes detach() to first turn the
stop into a clean SIGSTOP group-stop (consume the SIGTRAP with PT_CONTINUE,
kill(SIGSTOP), PT_DETACH, kill(SIGCONT)), so there is no pending signal to
redeliver. Verified: ~10x on the x87 benchmark, correct results, and a 50-second
program runs fully detached to completion. See loader/main.cpp detach().
Note: this applies to the ptrace/fork/inject-exports architecture here. The original
author's active successor, rosettax87_jit, injects in-process via dlopen and does
not use PT_DETACH, so this bug does not apply there.
- macOS 14 or later
- C compiler (clang)
- CMake
cmake -B build
cmake --build build
clang -v -arch x86_64 -mno-sse -mfpmath=387 ./sample/math.c -o ./build/math
Run the target program from the build folder:
./rosettax87 ./math
You will see a popup asking you to authorize debugging. Once approved, the process granted debug session. Reference: Debugging tool entitlement
Alternatively (Not Recommended), you can disable Debugging Restrictions part of System Integrity Protection (SIP) by running csrutil enable --without debug in macOS Recovery.
Warning: This reduces system security. NOT recommended.
You can use the brew wine@devel cask with RosettaHack x87. It supports launching Windows applications through Wine with an environment variable ROSETTA_X87_PATH.
- Install
wine@develusing Homebrew
brew install --cask wine@devel- To permanently set the environment variable, add the following to your
~/.bashrcor~/.zshrcfile:
export ROSETTA_X87_PATH=/Path/To/rosettax87- Run the Windows application
wine PATH_TO_BINARY.exeThis project is licensed under MIT.