summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibX86
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2022-12-10 15:05:07 +0200
committerAndreas Kling <kling@serenityos.org>2022-12-11 22:06:30 +0100
commit9a136e354d63c32c2471f473b1fed0cf3db9abde (patch)
treed4e6c5687ddb02f482030e6525dbdbf0afca337c /Userland/Libraries/LibX86
parentdd66f5e838767c970696e5dea5c3ae6fe7ff5dd3 (diff)
downloadserenity-9a136e354d63c32c2471f473b1fed0cf3db9abde.zip
LibX86: Use AddressSize::32 in Long mode
As the existing near-by comment says, the default size of displacements & immediates is 32 bits even in Long mode. This makes `disasm` work on our binaries in x86-64 builds.
Diffstat (limited to 'Userland/Libraries/LibX86')
-rw-r--r--Userland/Libraries/LibX86/Instruction.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h
index 10ea32adda..238e070285 100644
--- a/Userland/Libraries/LibX86/Instruction.h
+++ b/Userland/Libraries/LibX86/Instruction.h
@@ -1007,11 +1007,12 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, OperandSiz
, m_address_size(address_size)
{
VERIFY(operand_size != OperandSize::Size64);
- // Use address_size as the hint to switch into long mode, m_address_size refers to the default
- // size of displacements/immediates, which is 32 even in long mode, with the exception of moffset (see below).
+ // Use address_size as the hint to switch into long mode.
+ // m_address_size refers to the default size of displacements/immediates, which is 32 even in long mode (2.2.1.3 Displacement, 2.2.1.5 Immediates),
+ // with the exception of moffset (see below).
if (address_size == AddressSize::Size64) {
m_operand_size = OperandSize::Size32;
- m_address_size = AddressSize::Size64;
+ m_address_size = AddressSize::Size32;
m_mode = ProcessorMode::Long;
}
u8 prefix_bytes = 0;
@@ -1124,7 +1125,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, OperandSiz
return;
}
- // 2.2.1.3 Direct Memory-Offset MOVs
+ // 2.2.1.4 Direct Memory-Offset MOVs
auto effective_address_size = m_address_size;
if (m_mode == ProcessorMode::Long) {
switch (m_descriptor->format) {