From 12d0170e9283e25709937606483af7d0af7c8e2a Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 9 Mar 2026 16:36:00 +0000 Subject: separate: more implicit operand size bits --- CHANGELOG | 5 +++-- src/long_mode/mod.rs | 9 ++++++++- test/long_mode/operand.rs | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f454bc6..a1ef883 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,8 +7,9 @@ even when their corresponding extension is not selected. * added uarch-specific decoders for Zen 2, Zen 3, Zen 4, and Zen 5 * removed 3DNow support from AMD uarch-specific decoders after K10 -* push-immediate now reports a correct memory access side, fixing the prior - behavior of reporting to memory access size at all +* push-immediate, pushf, popf, leave, and xlat now all report a correct memory + access size, fixing the prior behavior of reporting to memory access size at + all ## 2.0.0 diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index dc54506..3062783 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -6627,8 +6627,15 @@ fn read_operands< instruction.mem_size = 8; } else if instruction.opcode == Opcode::RETF { instruction.mem_size = 10; + } else if instruction.opcode == Opcode::POPF { + instruction.mem_size = 8; + } else if instruction.opcode == Opcode::PUSHF { + instruction.mem_size = 8; + } else if instruction.opcode == Opcode::LEAVE { + instruction.mem_size = 8; + } else if instruction.opcode == Opcode::XLAT { + instruction.mem_size = 1; } - // TODO: leave? instruction.operands[0] = OperandSpec::Nothing; instruction.operand_count = 0; return Ok(()); diff --git a/test/long_mode/operand.rs b/test/long_mode/operand.rs index b94d39f..10c4deb 100644 --- a/test/long_mode/operand.rs +++ b/test/long_mode/operand.rs @@ -53,4 +53,12 @@ fn test_implied_memory_width() { // operand-size prefixed call and jump still reads 8 bytes (prefix ignored) assert_eq!(mem_size_of(&[0x66, 0xff, 0x10]), Some(8)); assert_eq!(mem_size_of(&[0x66, 0xff, 0x20]), Some(8)); + // pushf + assert_eq!(mem_size_of(&[0x9c]), Some(8)); + // popf + assert_eq!(mem_size_of(&[0x9d]), Some(8)); + // leave + assert_eq!(mem_size_of(&[0xc9]), Some(8)); + // xlat + assert_eq!(mem_size_of(&[0xd7]), Some(1)); } -- cgit v1.1