RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

IOS Dynarec(JIT) 64 bit devices

Open hotyute opened this issue 10 years ago • 12 comments

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

hotyute avatar Aug 29 '16 15:08 hotyute

Would be great for Odroid C2

kivutar avatar Aug 29 '16 15:08 kivutar

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 avatar Aug 29 '16 15:08 hrydgard

@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.

hotyute avatar Aug 29 '16 15:08 hotyute

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.

inactive123 avatar Aug 29 '16 16:08 inactive123

@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.

inactive123 avatar Aug 29 '16 16:08 inactive123

@twinaphex What about the Mupen64 core?

hotyute avatar Aug 29 '16 16:08 hotyute

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).

;)

Alex793 avatar Sep 03 '16 23:09 Alex793

Just checking up on the N64 core as well. Any updates?

hotyute avatar Sep 04 '16 15:09 hotyute

Hope Picodrove too and all other core using dynarec ;)

Alex793 avatar Sep 04 '16 19:09 Alex793

@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.

andres-asm avatar Sep 12 '16 05:09 andres-asm

It's great that they got pcsx's jit working.. Just need it for mupen64 now

hotyute avatar Sep 21 '16 12:09 hotyute

I've only implemented what I think is needed without having the hardware, AFAIK nobody reported it actually working yet.

notaz avatar Sep 21 '16 12:09 notaz