IOS Dynarec(JIT) 64 bit devices
Over at PPSSPP they accomplished Dynarec(JIT) on 64 bit IOS devices. I am wondering if we can accomplish this on some cores over here at retro arch? Particularly the Mupen64 core.. How would I go about doing this?
Reference this thread on its implementation: https://github.com/hrydgard/ppsspp/issues/8122
Would be great for Odroid C2
The actual code is in https://github.com/hrydgard/ppsspp/pull/8937
In summary, you need to:
-
Call
syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0);on startup, to pretend to be a debugger. This lets you map pages PROT_EXEC. This seems to require an "entitlement" of some sort.
-
In the JIT implementations, make sure to never map a page PROT_WRITE and PROT_EXEC at the same time. Whenever you need to change code, make the page PROT_READ|PROT_WRITE using mprotect, then change it back to PROT_READ|PROT_EXEC.
And that's pretty much it.
@hrydgard Thanks a lot. Well explained and very simple. Wish I had a MAC, or a PC that can handle virtualization well. Otherwise I'd do it myself.
HI @hrydgard, thanks for sharing this.
I have not forgotten about the mainline libretro PPSSPP port. Let me get back to you quickly on that.
@Fadi5555 It's probably best to take that up with @notaz since he still maintains the PCSX ReARMed repo and I don't think he would like it if I started hard forking.
@twinaphex What about the Mupen64 core?
Hi, if it's possible can we have a dynarec fix also for Picodrive (not perfect emulation for 32X on my Ipad Pro 9.7, on my Ipad Air 1 iOS 8 it's perfect with dynarec).
;)
Just checking up on the N64 core as well. Any updates?
Hope Picodrove too and all other core using dynarec ;)
@Fadi5555 we are all volunteers here. There is no iOS work being done ATM, iOS is not really convenient because of the cat and mouse game (updates, changes breaking compatibility, etc.)
Please stop badgering, it will be done in due time.
It's great that they got pcsx's jit working.. Just need it for mupen64 now
I've only implemented what I think is needed without having the hardware, AFAIK nobody reported it actually working yet.