Comment by saagarjha
6 years ago
Somewhat, the story for this is a bit complicated :) I'm sure the ptrace trick was already well known by the jailbreaking community long before I discovered it independently, but I used that to port TinyCC to iOS: https://github.com/saagarjha/tinycc/tree/ios. (This was after Apple allowed people to sideload apps on their devices, so I was planning on making an app that would let you write C on your phone. I made an early demo and even an app icon, but lost motivation after I couldn't figure out how to make my app appear in sidebar of the Files app, go figure.) Emulators started implementing it at some point, and after not being able to do anything useful with it I just stuck around whispering it to anyone who'd listen. At some point I realized that a Mach exception handler might help solve the freezing issue described in the post, and UTM was the first app where I actually implemented it to see if it would work (though I suggested it to Dolphin earlier: https://github.com/dolphin-emu/dolphin/pull/8492#issuecommen...). Since I ended writing essentially the same thing for PPSSPP (https://github.com/saagarjha/ppsspp) and I knew that there were other emulators that had the same issue, I figured I'd just write it up and point people at that instead of trying to send patches to all of them. I'm kind of lazy ;)
I am fascinated by your port of UTM and have to ask the question you’ve probably been asked thousands of times: is there any prospect of you releasing this on TestFlight?
Unfortunately, the JIT described here cannot be be used in an app submitted to Apple for review, which is required for all apps distributed on the App Store or via TestFlight. By the way, osy (who is also in this thread) is the author of UTM, so you'd want to ask them about project management decisions like these. I just submit patches :)
TestFlight has the same restrictions on app permissions and private API usage as the App Store. A UTM port that requires the get-task-allow permission to enable JIT cannot be distributed through TestFlight.