fix(relinker): decode XOP instructions #2568

Merged
oneandonlydean merged 1 commit from upstream-pr/2568 into main 2026-10-10 06:47:51 +00:00
oneandonlydean commented 2026-10-10 06:27:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T06:27:42Z.


Carrying @AchrafReyani's fix for #2559 while PR intake is paused. The commit is theirs, unchanged (cherry-picked from AchrafReyani/AnyPS5:fix/relinker-decode-xop, 2253d53d8a).

What

The x86 decoder now recognises the XOP escape (8F with a map-select field of 8 or above) and decodes those instructions instead of reading 8F E8 .. as POP r/m.

Why

Fixes #2559. Since #2238 (ba525633, "root code addresses taken by RIP-relative LEA"), code reached through RIP-relative lea is decoded, and some of it uses AMD XOP instructions. Decoded as POP, they put instruction boundaries in the wrong place, and the Windows conversion of three homebrew titles fails with Code analysis: overlapping instruction boundaries (PPSA74126, PPSA99082, PPSA99420). The Linux output was unaffected. Bisected to ba525633 in the issue.

Tested

  • The author's full build of the branch merged onto main bc40a6b5 (fork run 38027642514): Linux passes, the relinker passes on Linux, Windows and macOS, and Windows passes 606/606.
  • Amd64OnlyConverterTests covers the XOP decode.
  • tools/check_conventions.py passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4809262054 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2568). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T06:27:42Z. --- Carrying @AchrafReyani's fix for #2559 while PR intake is paused. The commit is theirs, unchanged (cherry-picked from `AchrafReyani/AnyPS5:fix/relinker-decode-xop`, 2253d53d8a). ### What The x86 decoder now recognises the XOP escape (`8F` with a map-select field of 8 or above) and decodes those instructions instead of reading `8F E8 ..` as `POP r/m`. ### Why Fixes #2559. Since #2238 (ba525633, "root code addresses taken by RIP-relative LEA"), code reached through RIP-relative `lea` is decoded, and some of it uses AMD XOP instructions. Decoded as `POP`, they put instruction boundaries in the wrong place, and the Windows conversion of three homebrew titles fails with `Code analysis: overlapping instruction boundaries` (PPSA74126, PPSA99082, PPSA99420). The Linux output was unaffected. Bisected to ba525633 in the issue. ### Tested - The author's full build of the branch merged onto main bc40a6b5 (fork run 38027642514): Linux passes, the relinker passes on Linux, Windows and macOS, and Windows passes 606/606. - `Amd64OnlyConverterTests` covers the XOP decode. - `tools/check_conventions.py` passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2568
No description provided.