An instruction sequence like 0x66 0xe8 0x59 0xcf was incorrectly disassembled due to a missing TYPE_REL16 in the translateImmediate type switch, and resulted in a signed short relative immediate in callw, like 0xcf59, to disassemble to 53081 instead of -12455.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
add test please, perhaps next to the 'callw' test in test/MC/Disassembler/X86/x86-16.txt
Comment Actions
I added the unit tests as a separate commit; I was unsure what the protocol is in this case. Just in case, I've added the same diff in this comment.
diff --git a/test/MC/Disassembler/X86/x86-32.txt b/test/MC/Disassembler/X86/x86-32.txt index 830b830..aaf9e5b 100644 --- a/test/MC/Disassembler/X86/x86-32.txt +++ b/test/MC/Disassembler/X86/x86-32.txt @@ -54,6 +54,12 @@ # CHECK: calll -1234 0xe8 0x2e 0xfb 0xff 0xff +# CHECK: callw -1 +0x66 0xe8 0xff 0xff + +# CHECK: callw 32767 +0x66 0xe8 0xff 0x7f + # CHECK: lfence 0x0f 0xae 0xe8 diff --git a/test/MC/Disassembler/X86/x86-64.txt b/test/MC/Disassembler/X86/x86-64.txt index f000d15..3088619 100644 --- a/test/MC/Disassembler/X86/x86-64.txt +++ b/test/MC/Disassembler/X86/x86-64.txt @@ -301,3 +301,9 @@ # CHECK: movq %rax, 1515870810 0x67, 0x48 0xa3 0x5a 0x5a 0x5a 0x5a + +# CHECK: callq -32769 +0xe8 0xff 0x7f 0xff 0xff + +# CHECK: callq 32767 +0xe8 0xff 0x7f 0x00 0x00
Comment Actions
*ping* This patch has been sitting for over a month. I don't have push rights; someone else needs to land it.