rpcs3 icon indicating copy to clipboard operation
rpcs3 copied to clipboard

LLVM on Aarch64 Tracker

Open kd-11 opened this issue 3 months ago • 7 comments

LLVM doesn't work properly on aarch64. There are architectural reasons for this, particularly when used within RPCS3. There is some internal progress for all of these, so we're tracking things here to collaborate more efficiently.

Pre

  • [x] Re-implement VM escape on aarch46 using far-jump and context save/restore.

Main

  • [x] PPU LLVM

    • [x] Reimplement call gate using register context only.
    • [x] Diagnose mysterious ret path causing safety asserts to be hit
    • [x] Fix commercial games crashing with nullptr access.
    • [x] Refactoring/cleanup (guest/host context switches, to be shared with SPU)
    • [x] Identify and fix regression after rebase on recent master

    Obsolete implementation

    • [x] Breaking from guest to hypervisor (escape) is broken because of callstack unwinding being incompatible with LLVM's GHC implementation on aarch64.
      • [x] Worked around by having a manual call stack.
    • [x] LLVM is clobbering the link register in GHC blocks making them noreturn.
      • [x] Worked around by modifying LLVM's reserved register list for GHC to at least leave the LR alone.
      • [x] File a report with upstream with generated blocks.
  • [x] SPU LLVM

    • [x] Same escape issue as PPU LLVM
    • [x] Compilation failures
    • [x] Stack smashing
    • [x] Stack underrun
    • [x] Reimplement unwind + stack scratch hacks as function transformation passes and remove inline asm hooks.
    • [x] Properly formalize/refactor guest-host(hypervisor) context switches and have the code in one place. Currently littered everywhere.
    • [x] Fix lockup after rebase on current master
    • [x] ~~Basic optimizations (call, shufb)~~ (deferred)
    • [x] ~~Other undiagnosed issues (list will be added)~~

kd-11 avatar May 08 '24 13:05 kd-11