fix(relinker): preserve jump tables formed by 32-bit LEA #19569

Merged
PolkadotDom merged 2 commits from upstream-pr/19569 into main 2026-11-25 15:33:57 +00:00
PolkadotDom commented 2026-11-13 15:08:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PolkadotDom on 2026-11-13T15:08:54Z.


What

The AMD-only converter's jump-table scan accounts for 32-bit addressing but not for LEA's 32-bit destination. A RIP-relative lea ..., %ecx truncates the result to 32 bits even without 67. Missing that table allows a vector-store conversion to move an instruction that the table jumps to.

Truncate the table address when LEA has a 32-bit operand, in addition to the existing address-size rule. REX.W takes precedence over 66; a partial 16-bit destination is not newly interpreted as a zero-extended 32-bit address. The existing test matrix now covers default 32-bit operands, REX.W, and 66 plus REX.W, with RIP/EIP, no segment/FS/GS, and normal/wrapping displacements.

For the six-byte LEA at 0x1000, the displacement to table 0x8000100e sign-extends to an intermediate high address; the ECX result is 0x8000100e. The converter must preserve the second table destination after the four-byte store. The regression checks both placement and destination bytes.

Semantics: Intel SDM Volume 2A, LEA, 64-bit Mode LEA Operation with Address and Operand Size Attributes (Intel manual).

Tested

Updated November 21 on main e60b2f74ad. The table-address overflow guard now applies to full-width arithmetic. A 32-bit operand or address size still truncates the table base. Relative entries retain main’s existing checks. Rebuilt the Windows converter target and passed amd64_only_converter, including the 36-case matrix. The November 15 overlap notes below describe the earlier base.

Updated November 15: rebased onto current main 03f9083042 as cc723fb7f6. The rebase applied without a manual conflict resolution; the LEA-width fix and its 36-case regression are unchanged. Rebuilt the relinker and converter, Windows converter, conversion and game-patch targets on Windows (GCC 12.2, Release relinker-only); all seven focused CTests below pass. Rebuilt and passed amd64_only_converter on Ubuntu/WSL (GCC 11.4). A fresh negative control using this main's production file fails the regression (CTest exit 8); restoring this head passes. Conventions and whitespace pass. Earlier results and the overlap assessment below retain their original pins.

Base 19ba356e59; candidate f46a0a31ec.

  • Windows x86-64, GCC 12.2, Release relinker-only: built relinker and the converter, Windows converter, conversion and game-patch test targets. Seven focused CTests pass: amd64_only_converter, amd64_only_windows, relinker_conversion, relinker_game_patch, relinker_executables, mulx_conversion, to_rosetta.
  • Ubuntu/WSL, GCC 11.4: rebuilt amd64_only_converter_tests and its CTest passes.
  • The conversion matrix covers 36 combinations and checks preserved jump destinations, including REX.W precedence. The table address was adjusted by two bytes so its signed entries remain representable with the shorter default-width LEA.
  • Negative control with the final fixture: restoring main's production file makes amd64_only_converter fail with A jump table's address or operand size did not protect the instruction after a 256-bit store. Restoring the fix and rebuilding passes.
  • Native Linux x86-64 probe executes a default-width LEA, signed entry load, add, and indirect jump. Both destinations return 41/42 with no segment, FS, and GS: six executions pass.
  • Conventions and whitespace pass. Merge preview against main c612c4c9e8 is clean. The overlap scan checked 1,515 current open PRs, verifying 1,512 cached head hashes and fetching three changed/missing heads plus main. Exit 2 reports three branches already conflicting with main; all shared-file diffs were inspected manually. #11525 changes embedded-data masking and its separate test; #12678 adds the bit-permutation option. Neither changes LEA operand-width handling. #15903 adds unconditional displacement-wrap rejection in this same routine and already conflicts with the merged #15639 address-size fix. Those guards would skip valid wrapping LEAs; this PR does not adopt or depend on them. Their interaction still requires explicit resolution when #15903 is rebased; no clean combined merge or agreed ordering is claimed.

Synthetic conversion and native input-instruction validation only; no PS5 binary/title, Apple/Rosetta execution, GPU run or full product build.

Native jump-table probe

Compile with g++ -std=c++20 -O2 probe.cpp -o probe and run on Linux x86-64. Its mappings are private and use MAP_FIXED_NOREPLACE.

#include <sys/mman.h>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <vector>

int main() {
    constexpr std::uintptr_t codeAddress = 0x10000000;
    constexpr std::uintptr_t dataAddress = 0x90000000;
    constexpr std::uintptr_t tableAddress = dataAddress + 0x10;
    auto* code = static_cast<std::uint8_t*>(mmap(reinterpret_cast<void*>(codeAddress), 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0));
    auto* data = static_cast<std::uint8_t*>(mmap(reinterpret_cast<void*>(dataAddress), 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0));
    if (code == MAP_FAILED || data == MAP_FAILED) {
        std::perror("mmap");
        return 1;
    }
    const auto put32 = [](std::uint8_t* at, std::uint32_t value) { std::memcpy(at, &value, 4); };
    for (const std::uint8_t prefix : {0x00, 0x64, 0x65}) {
        if (mprotect(code, 4096, PROT_READ | PROT_WRITE)) return 2;
        std::vector<std::uint8_t> bytes{0x89, 0xf8};
        if (prefix) bytes.push_back(prefix);
        bytes.insert(bytes.end(), {0x8d, 0x0d, 0, 0, 0, 0});
        put32(bytes.data() + bytes.size() - 4, static_cast<std::uint32_t>(tableAddress - (codeAddress + bytes.size())));
        bytes.insert(bytes.end(), {0x48, 0x63, 0x04, 0x81, 0x48, 0x01, 0xc8, 0xff, 0xe0});
        std::memcpy(code, bytes.data(), bytes.size());
        for (unsigned index = 0; index < 2; ++index) {
            const auto offset = 0x20 + index * 0x10;
            code[offset] = 0xb8;
            put32(code + offset + 1, 41 + index);
            code[offset + 5] = 0xc3;
            put32(data + 0x10 + 4 * index, static_cast<std::uint32_t>(codeAddress + offset - tableAddress));
        }
        if (mprotect(code, 4096, PROT_READ | PROT_EXEC)) return 3;
        auto function = reinterpret_cast<int (*)(int)>(code);
        for (int index = 0; index < 2; ++index) {
            const auto result = function(index);
            std::printf("prefix=%02x index=%d result=%d\n", prefix, index, result);
            if (result != 41 + index) return 4;
        }
    }
    munmap(code, 4096);
    munmap(data, 4096);
}
prefix=00 index=0 result=41
prefix=00 index=1 result=42
prefix=64 index=0 result=41
prefix=64 index=1 result=42
prefix=65 index=0 result=41
prefix=65 index=1 result=42

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5297893387 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19569). Originally posted by [PolkadotDom](https://github.com/PolkadotDom) on 2026-11-13T15:08:54Z. --- ### What The AMD-only converter's jump-table scan accounts for 32-bit addressing but not for LEA's 32-bit destination. A RIP-relative `lea ..., %ecx` truncates the result to 32 bits even without `67`. Missing that table allows a vector-store conversion to move an instruction that the table jumps to. Truncate the table address when LEA has a 32-bit operand, in addition to the existing address-size rule. REX.W takes precedence over `66`; a partial 16-bit destination is not newly interpreted as a zero-extended 32-bit address. The existing test matrix now covers default 32-bit operands, REX.W, and `66` plus REX.W, with RIP/EIP, no segment/FS/GS, and normal/wrapping displacements. For the six-byte LEA at `0x1000`, the displacement to table `0x8000100e` sign-extends to an intermediate high address; the ECX result is `0x8000100e`. The converter must preserve the second table destination after the four-byte store. The regression checks both placement and destination bytes. Semantics: Intel SDM Volume 2A, LEA, 64-bit Mode LEA Operation with Address and Operand Size Attributes ([Intel manual](https://cdrdv2-public.intel.com/825743/325462-sdm-vol-1-2abcd-3abcd-4.pdf)). ### Tested Updated November 21 on main `e60b2f74ad`. The table-address overflow guard now applies to full-width arithmetic. A 32-bit operand or address size still truncates the table base. Relative entries retain main’s existing checks. Rebuilt the Windows converter target and passed `amd64_only_converter`, including the 36-case matrix. The November 15 overlap notes below describe the earlier base. Updated November 15: rebased onto current main `03f9083042` as `cc723fb7f6`. The rebase applied without a manual conflict resolution; the LEA-width fix and its 36-case regression are unchanged. Rebuilt the relinker and converter, Windows converter, conversion and game-patch targets on Windows (GCC 12.2, Release relinker-only); all seven focused CTests below pass. Rebuilt and passed `amd64_only_converter` on Ubuntu/WSL (GCC 11.4). A fresh negative control using this main's production file fails the regression (CTest exit 8); restoring this head passes. Conventions and whitespace pass. Earlier results and the overlap assessment below retain their original pins. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Base `19ba356e59`; candidate `f46a0a31ec`. - Windows x86-64, GCC 12.2, Release relinker-only: built relinker and the converter, Windows converter, conversion and game-patch test targets. Seven focused CTests pass: `amd64_only_converter`, `amd64_only_windows`, `relinker_conversion`, `relinker_game_patch`, `relinker_executables`, `mulx_conversion`, `to_rosetta`. - Ubuntu/WSL, GCC 11.4: rebuilt `amd64_only_converter_tests` and its CTest passes. - The conversion matrix covers 36 combinations and checks preserved jump destinations, including REX.W precedence. The table address was adjusted by two bytes so its signed entries remain representable with the shorter default-width LEA. - Negative control with the final fixture: restoring main's production file makes `amd64_only_converter` fail with `A jump table's address or operand size did not protect the instruction after a 256-bit store`. Restoring the fix and rebuilding passes. - Native Linux x86-64 probe executes a default-width LEA, signed entry load, add, and indirect jump. Both destinations return 41/42 with no segment, FS, and GS: six executions pass. - Conventions and whitespace pass. Merge preview against main `c612c4c9e8` is clean. The overlap scan checked 1,515 current open PRs, verifying 1,512 cached head hashes and fetching three changed/missing heads plus main. Exit 2 reports three branches already conflicting with main; all shared-file diffs were inspected manually. #11525 changes embedded-data masking and its separate test; #12678 adds the bit-permutation option. Neither changes LEA operand-width handling. #15903 adds unconditional displacement-wrap rejection in this same routine and already conflicts with the merged #15639 address-size fix. Those guards would skip valid wrapping LEAs; this PR does not adopt or depend on them. Their interaction still requires explicit resolution when #15903 is rebased; no clean combined merge or agreed ordering is claimed. Synthetic conversion and native input-instruction validation only; no PS5 binary/title, Apple/Rosetta execution, GPU run or full product build. <details><summary>Native jump-table probe</summary> Compile with `g++ -std=c++20 -O2 probe.cpp -o probe` and run on Linux x86-64. Its mappings are private and use `MAP_FIXED_NOREPLACE`. ```cpp #include <sys/mman.h> #include <cstdint> #include <cstdio> #include <cstring> #include <vector> int main() { constexpr std::uintptr_t codeAddress = 0x10000000; constexpr std::uintptr_t dataAddress = 0x90000000; constexpr std::uintptr_t tableAddress = dataAddress + 0x10; auto* code = static_cast<std::uint8_t*>(mmap(reinterpret_cast<void*>(codeAddress), 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0)); auto* data = static_cast<std::uint8_t*>(mmap(reinterpret_cast<void*>(dataAddress), 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0)); if (code == MAP_FAILED || data == MAP_FAILED) { std::perror("mmap"); return 1; } const auto put32 = [](std::uint8_t* at, std::uint32_t value) { std::memcpy(at, &value, 4); }; for (const std::uint8_t prefix : {0x00, 0x64, 0x65}) { if (mprotect(code, 4096, PROT_READ | PROT_WRITE)) return 2; std::vector<std::uint8_t> bytes{0x89, 0xf8}; if (prefix) bytes.push_back(prefix); bytes.insert(bytes.end(), {0x8d, 0x0d, 0, 0, 0, 0}); put32(bytes.data() + bytes.size() - 4, static_cast<std::uint32_t>(tableAddress - (codeAddress + bytes.size()))); bytes.insert(bytes.end(), {0x48, 0x63, 0x04, 0x81, 0x48, 0x01, 0xc8, 0xff, 0xe0}); std::memcpy(code, bytes.data(), bytes.size()); for (unsigned index = 0; index < 2; ++index) { const auto offset = 0x20 + index * 0x10; code[offset] = 0xb8; put32(code + offset + 1, 41 + index); code[offset + 5] = 0xc3; put32(data + 0x10 + 4 * index, static_cast<std::uint32_t>(codeAddress + offset - tableAddress)); } if (mprotect(code, 4096, PROT_READ | PROT_EXEC)) return 3; auto function = reinterpret_cast<int (*)(int)>(code); for (int index = 0; index < 2; ++index) { const auto result = function(index); std::printf("prefix=%02x index=%d result=%d\n", prefix, index, result); if (result != 41 + index) return 4; } } munmap(code, 4096); munmap(data, 4096); } ``` ```text prefix=00 index=0 result=41 prefix=00 index=1 result=42 prefix=64 index=0 result=41 prefix=64 index=1 result=42 prefix=65 index=0 result=41 prefix=65 index=1 result=42 ``` </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
PrivacyOnion commented 2026-11-13 17:47:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T17:47:19Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against f46a0a31ec:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: amd64_only_converter_tests built cleanly.
  • CTest (amd64_only_converter):
    1/1 Test #5032: amd64_only_converter .............   Passed    0.15 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/relinker/codegen/src/Amd64OnlyConverter.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #5032: amd64_only_converter .............***Failed    0.10 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified in Amd64OnlyConverter.cpp:327 that std::span(seg).subspan(match.Offset, info.OpcodeOffset) stays within bounds of seg, as info.OpcodeOffset is bounded by match.Length and match.Offset + match.Length <= seg.size().
    • Verified in Amd64OnlyConverter.cpp:328-330 that operandSize32 logic correctly evaluates (info.RexPrefix & X64OpcodeConstants::RexWBit) == 0 and scans prefixes for X64OpcodeConstants::PrefixOperandSize (0x66), ensuring REX.W takes precedence over 0x66 per Intel SDM 64-bit LEA semantics.
    • Verified in Amd64OnlyConverter.cpp:331 that static_caststd::uint32_t(table) accurately models x86-64 hardware behavior where 32-bit register destinations zero-extend into the 64-bit register, resolving the missed jump table at 0x8000100E.
    • Verified in Amd64OnlyConverter.cpp:332-343 that segment bounds and file offset checks (data.Offset > fileBytes.size() || data.FileSize > fileBytes.size() - data.Offset) protect against out-of-bounds reads during jump table entry processing.
    • Verified in Amd64OnlyConverterTests.cpp:1216-1240 that the test matrix tests 36 permutations across addressSize32, segment overrides, and operand widths, properly asserting preserved jump table destinations at offset 17.
    • Verified strict AGENTS.md compliance, confirming zero added code comments in production and test files, no title-specific logic, and conventional commit PR title format.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5895598687 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19569#pullrequestreview-5895598687). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-13T17:47:19Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `f46a0a31ec`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `amd64_only_converter_tests` built cleanly. - **CTest** (`amd64_only_converter`): ``` 1/1 Test #5032: amd64_only_converter ............. Passed 0.15 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/relinker/codegen/src/Amd64OnlyConverter.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #5032: amd64_only_converter .............***Failed 0.10 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - Verified in Amd64OnlyConverter.cpp:327 that std::span(seg).subspan(match.Offset, info.OpcodeOffset) stays within bounds of seg, as info.OpcodeOffset is bounded by match.Length and match.Offset + match.Length <= seg.size(). - Verified in Amd64OnlyConverter.cpp:328-330 that operandSize32 logic correctly evaluates (info.RexPrefix & X64OpcodeConstants::RexWBit) == 0 and scans prefixes for X64OpcodeConstants::PrefixOperandSize (0x66), ensuring REX.W takes precedence over 0x66 per Intel SDM 64-bit LEA semantics. - Verified in Amd64OnlyConverter.cpp:331 that static_cast<std::uint32_t>(table) accurately models x86-64 hardware behavior where 32-bit register destinations zero-extend into the 64-bit register, resolving the missed jump table at 0x8000100E. - Verified in Amd64OnlyConverter.cpp:332-343 that segment bounds and file offset checks (data.Offset > fileBytes.size() || data.FileSize > fileBytes.size() - data.Offset) protect against out-of-bounds reads during jump table entry processing. - Verified in Amd64OnlyConverterTests.cpp:1216-1240 that the test matrix tests 36 permutations across addressSize32, segment overrides, and operand widths, properly asserting preserved jump table destinations at offset 17. - Verified strict AGENTS.md compliance, confirming zero added code comments in production and test files, no title-specific logic, and conventional commit PR title format. - Note: the AI-assisted checkbox can stay. Looks Good To Me
MarcZX10 commented 2026-11-21 09:59:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T09:59:44Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the inspected implementation and regression tests support the stated LEA width handling.

What I ran

Reviewed head cc723fb7f6554cd65b57e545fd41d7052f0f16e3 using repo_read.py to read the prepared diff and relevant source ranges. No tests were run by me.

Results

Check Result Note
Diff and changed files passed Both changed files read
Targeted decoder context passed Prefix handling inspected
Tests not run Results in description are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests were executed during this review. The author reports passing focused tests and a negative control in the PR description; those runs were not independently verified. No PS5 binary, title, Apple/Rosetta execution, GPU run, or full product build was inspected. The review folder’s files.json was not available through the reader; manifest lists two changed files, both included and read. Excluded files: not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004504955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19569#pullrequestreview-6004504955). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T09:59:44Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the inspected implementation and regression tests support the stated LEA width handling. ## What I ran Reviewed head `cc723fb7f6554cd65b57e545fd41d7052f0f16e3` using `repo_read.py` to read the prepared diff and relevant source ranges. No tests were run by me. ## Results | Check | Result | Note | |---|---|---| | Diff and changed files | passed | Both changed files read | | Targeted decoder context | passed | Prefix handling inspected | | Tests | not run | Results in description are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No tests were executed during this review. The author reports passing focused tests and a negative control in the PR description; those runs were not independently verified. No PS5 binary, title, Apple/Rosetta execution, GPU run, or full product build was inspected. The review folder’s `files.json` was not available through the reader; manifest lists two changed files, both included and read. Excluded files: not verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-23 01:15:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T01:15:22Z.

Review: COMMENTED


Reviewed — no blocking findings

The reviewed change adds LEA operand-width handling to jump-table discovery, and the inspected code supports the stated 32-bit truncation behavior.

What I ran

Inspected head dbe2b6c7e8443ff6ee63a98fad7739bf1a7421a using repo_read.py; no commands or tests were run in this environment.

Read the prepared description, commits, manifest, diff, and the changed functions and relevant decoder definitions in core/relinker/codegen/src/Amd64OnlyConverter.cpp, core/relinker/codegen/tests/Amd64OnlyConverterTests.cpp, core/relinker/codegen/src/x86/X64InstructionDecoder.cpp, and core/relinker/codegen/include/codegen/x86/X64OpcodeConstants.hpp. The manifest lists both changed files as included; no changed files are listed as excluded.

Results

Check Result Note
Source review passed Inspected changed logic and regression matrix
Build and tests not run Author-reported results were not independently run
Negative control not run Author reports the regression fails without the fix

Negative control

Not run in this environment. The description reports that reverting the production change makes the regression fail.

Findings

Blocking

None.

Non-blocking

None.

Sources

The changed logic derives 32-bit table-address truncation from address size or default-width LEA, while REX.W takes precedence over the operand-size prefix (core/relinker/codegen/src/Amd64OnlyConverter.cpp:327-337). The added matrix covers default-width LEA, REX.W, REX.W with 66, address-size override, segment prefixes, and low and high table addresses (core/relinker/codegen/tests/Amd64OnlyConverterTests.cpp:1211-1245).

Not verified

The reported Windows and Ubuntu/WSL builds, CTests, native probe, and negative control were not independently run. No PS5 binary or title, Apple/Rosetta execution, GPU run, or full product build was verified, as the description also notes.

To get this to a good state

Nothing is required. Optional: retain the reported focused build and test coverage when updating the PR head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6015569701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19569#pullrequestreview-6015569701). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T01:15:22Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The reviewed change adds LEA operand-width handling to jump-table discovery, and the inspected code supports the stated 32-bit truncation behavior. ## What I ran Inspected head `dbe2b6c7e8443ff6ee63a98fad7739bf1a7421a` using `repo_read.py`; no commands or tests were run in this environment. Read the prepared description, commits, manifest, diff, and the changed functions and relevant decoder definitions in `core/relinker/codegen/src/Amd64OnlyConverter.cpp`, `core/relinker/codegen/tests/Amd64OnlyConverterTests.cpp`, `core/relinker/codegen/src/x86/X64InstructionDecoder.cpp`, and `core/relinker/codegen/include/codegen/x86/X64OpcodeConstants.hpp`. The manifest lists both changed files as included; no changed files are listed as excluded. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Inspected changed logic and regression matrix | | Build and tests | not run | Author-reported results were not independently run | | Negative control | not run | Author reports the regression fails without the fix | ## Negative control Not run in this environment. The description reports that reverting the production change makes the regression fail. ## Findings ### Blocking None. ### Non-blocking None. ## Sources The changed logic derives 32-bit table-address truncation from address size or default-width LEA, while REX.W takes precedence over the operand-size prefix (`core/relinker/codegen/src/Amd64OnlyConverter.cpp:327-337`). The added matrix covers default-width LEA, REX.W, REX.W with `66`, address-size override, segment prefixes, and low and high table addresses (`core/relinker/codegen/tests/Amd64OnlyConverterTests.cpp:1211-1245`). ## Not verified The reported Windows and Ubuntu/WSL builds, CTests, native probe, and negative control were not independently run. No PS5 binary or title, Apple/Rosetta execution, GPU run, or full product build was verified, as the description also notes. ## To get this to a good state Nothing is required. Optional: retain the reported focused build and test coverage when updating the PR head.
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!19569
No description provided.