mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1392] x64_recomp: handle 0x67 address-size override in memory and moffs operands (X64-RECOMP-ADDRSIZE-67) #1421
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1421
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1392
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/x64-recomp-addrsize-67📝 Commits (1)
442ef0ax64_recomp: handle 0x67 address-size override in memory and moffs operands📊 Changes
2 files changed (+284 additions, -27 deletions)
View changed files
➕
tests/test_x64_recomp_addrsize67.py(+253 -0)📝
tools/x64_recomp.py(+31 -27)📄 Description
Item ID:
X64-RECOMP-ADDRSIZE-67Summary
Fixes handling of the
0x67address-size override prefix (32-bit effective addressing in 64-bit mode) intools/x64_recomp.py:moffs(A0..A3, tokenQ) in_finish: reads a 4-byte unsignedmoffs32whenins.addrsizeis set instead of always reading 8 bytes (which previously consumed subsequent instruction bytes or raisedDecodeError("truncated imm"))._finishand_finish_group: tags memory operands withaddrsize = 4whenins.addrsizeis set, and truncates RIP-relative effective addresses to 32 bits ((ins.addr + ins.size + disp) & 0xFFFFFFFF) per Intel SDM Vol. 2A §2.2.1.6._mem_addr: emitssf=0(W-register) ARM64 arithmetic/moves/shifts (MOV,ADD,SUB,ADD (shifted reg),LSL) and masks immediate/absolute/disp32-only addresses to 32 bits whenm.get("addrsize") == 4, wrapping modulo2^32and zero-extending to 64 bits (includingdisp == 0withbase == rd,[disp32]zero-extension vs 64-bit sign-extension, and large displacements>= 4096/<= -4096).Tests & Verification
upstream/main28a32e190):python3 -m compileall -q make_game.py tools tests— OKpython3 -I scripts/check_no_game_data.py tools/x64_recomp.py tests/test_x64_recomp_addrsize67.py— OKpython3 -I tests/test_x64_recomp_addrsize67.py -v— 3 static decode/codegen tests OK (3 exec tests skip cleanly without#1174runner)python3 -I tests/test_x64_recomp.py— 6 static OK (26 exec skipped)python3 -I tests/test_text_write_line_endings.py— 3/3 OKtests/test_x64_recomp_addrsize67.pyon unpatchedupstream/main+#1174): 19 failures (FAILED (failures=19)).#1174+ all 18 other openx64_recompPR branches):tests/test_x64_recomp_addrsize67.py: 6/6 OK (0 skipped) on native Apple M5 arm64tests/test_x64_recomp_*.pysuites combined: 138/138 OK (0 skipped)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.