Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASM: Another sign extend bug in #3421 #3471

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions unittests/32Bit_ASM/FEX_bugs/SignExtendBug.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
{
"RegData": {
"RAX": "0x41424344",
"RBX": "0x41424344"
"RBX": "0x41424344",
"RCX": "0x51525354"
},
"MemoryRegions": {
"0x00fd0000": "4096",
"0xf0000000": "4096"
},
"MemoryData": {
"0xf0000000": "0x41424344"
"0xf0000000": "0x41424344",
"0x00fd0000": "0x51525354"
},
"Mode": "32BIT"
}
Expand All @@ -27,4 +30,14 @@ jmp .test
.test:
mov ebx, [ebx+ecx]

; Ensures that zext occurs correctly with SIB indexing with second argument not having sign bit set but "index" having sign bit.
; Originally saw in Metal Gear Rising Revengeance with a `jmp dword [ecx*4+0xfdbf10]` instruction.
; With ecx = 0xfffffff4 = -12. This is them loading a switch table's branches just before the switch base.
mov ecx, -12

; Break the block so it can't optimize through.
jmp .test2
.test2:

mov ecx, [ecx*4+0x00fd_0030]
hlt
Loading