logoalt Hacker News

aytoday at 12:27 AM1 replyview on HN

I went down a deep but entertaining rabbit hole in the other direction for fun: https://github.com/ayourtch-llm/fakelinux - initially with the idea “just replace the syscalls in the executable with some sort of a trap and handle that”.

It almost worked, unfortunately MacOS reserves x18 for platform purposes and Linux doesn’t.

The result is some sort of pretty mad contraption which works sufficiently often to compile aarch64 Linux VPP and its dependencies on the Mac using Linux gcc :)

I suppose with some polish it might be useful for something..


Replies

ishaderdevicemgtoday at 1:52 AM

Recently, Apple has made it so with a special entitlement, com.apple.private.custom-x18-abi iirc, you can actually use the x18 register, mainly so ARM64 versions of WINE/CrossOver can run outside of Rosetta, since they'll be partially killing Rosetta in macOS 28.

I believe you can find slightly more info on how to use it in some XNU (macOS kernel) tests, namely this one: https://github.com/apple-oss-distributions/xnu/blob/main/tes...

show 2 replies