diff options
author | iximeow <me@iximeow.net> | 2023-01-28 14:08:52 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2023-07-04 19:01:38 -0700 |
commit | 9f88282aab105a829cae9987a99bb5aca7b04eff (patch) | |
tree | 2eacd7a891fe3247b17a324795c3ffbfad25de59 | |
parent | 584f2fac745240373c05c39b51e503031d213ea1 (diff) |
OperandCode as a u16 caused gross movzwl, this seems just a bit better
-rw-r--r-- | src/long_mode/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index c75ad0b..723b669 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -4833,8 +4833,8 @@ impl OperandCodeBuilder { OperandCodeBuilder { bits: 0 } } - const fn bits(&self) -> u16 { - self.bits + const fn bits(&self) -> u32 { + self.bits as u32 } const fn from_bits(bits: u16) -> Self { @@ -4997,7 +4997,7 @@ pub struct OperandCodeWrapper { code: OperandCode } // | // | // ---------------------------> read modr/m? -#[repr(u16)] +#[repr(u32)] #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum OperandCode { Ivs = OperandCodeBuilder::new().special_case(25).bits(), @@ -6897,7 +6897,7 @@ fn read_operands< // reversed-operands `movbe` and fairly unlikely. that case is handled in // `unlikely_operands`. TODO: maybe this could just be a bit in `operand_code` for // "memory-only mmm"? - if operand_code.bits() == (OperandCode::Gv_M as u16) { + if operand_code.bits() == (OperandCode::Gv_M as u32) { return Err(DecodeError::InvalidOperand); } read_modrm_reg(instruction, words, modrm, bank, sink)? @@ -6942,7 +6942,7 @@ fn read_operands< instruction.regs[0].num = ((modrm >> 3) & 7) + if instruction.prefixes.rex_unchecked().r() { 0b1000 } else { 0 }; // for some encodings, the rrr field selects an opcode, not an operand - if operand_code.bits() != OperandCode::ModRM_0xc1_Ev_Ib as u16 && operand_code.bits() != OperandCode::ModRM_0xff_Ev as u16 { + if operand_code.bits() != OperandCode::ModRM_0xc1_Ev_Ib as u32 && operand_code.bits() != OperandCode::ModRM_0xff_Ev as u32 { sink.record( modrm_start + 3, modrm_start + 5, |