[PATCH] D126726: [X86][Disassembler] Fix displacement operand size for symbolizer
Maksim Panchenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 9 17:49:43 PDT 2022
maksfb updated this revision to Diff 435748.
maksfb added a comment.
Address comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126726/new/
https://reviews.llvm.org/D126726
Files:
llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
llvm/unittests/MC/X86/X86MCDisassemblerTest.cpp
Index: llvm/unittests/MC/X86/X86MCDisassemblerTest.cpp
===================================================================
--- llvm/unittests/MC/X86/X86MCDisassemblerTest.cpp
+++ llvm/unittests/MC/X86/X86MCDisassemblerTest.cpp
@@ -142,4 +142,10 @@
checkBytes({0x49, 0xc7, 0x04, 0x24, 0xf5, 0xfe, 0xff, 0xff});
checkOperand(0, 0, 4, 0);
checkOperand(1, 0xfffffffffffffef5, 4, 4);
+
+ // mov %ax, 0x1568179(%rbx)
+ // Test that the displacement operand size is not affected by the operand
+ // size override prefix.
+ checkBytes({0x66, 0x89, 0x83, 0x79, 0x81, 0x56, 0x01});
+ checkOperand(0, 0x1568180, 3, 4);
}
Index: llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
===================================================================
--- llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
+++ llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
@@ -493,16 +493,15 @@
insn->displacementSize = (insn->hasAdSize ? 2 : 4);
insn->immediateSize = (insn->hasOpSize ? 2 : 4);
} else if (insn->mode == MODE_64BIT) {
+ insn->displacementSize = 4;
if (insn->rexPrefix && wFromREX(insn->rexPrefix)) {
insn->registerSize = 8;
insn->addressSize = (insn->hasAdSize ? 4 : 8);
- insn->displacementSize = 4;
insn->immediateSize = 4;
insn->hasOpSize = false;
} else {
insn->registerSize = (insn->hasOpSize ? 2 : 4);
insn->addressSize = (insn->hasAdSize ? 4 : 8);
- insn->displacementSize = (insn->hasOpSize ? 2 : 4);
insn->immediateSize = (insn->hasOpSize ? 2 : 4);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126726.435748.patch
Type: text/x-patch
Size: 1569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220610/2df7c5f4/attachment.bin>
More information about the llvm-commits
mailing list