From 7394c9dc4727d42b3ccbdf38f114ae0b5d28069d Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 2 Jul 2021 19:45:34 -0700 Subject: intel keylocker instructions that access memory have memory access sizes --- src/long_mode/mod.rs | 8 ++++++++ src/protected_mode/mod.rs | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 22ffe58..e8947ea 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -8610,6 +8610,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 48; instruction.opcode = Opcode::AESENCWIDE128KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8618,6 +8619,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 48; instruction.opcode = Opcode::AESDECWIDE128KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8626,6 +8628,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 64; instruction.opcode = Opcode::AESENCWIDE256KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8634,6 +8637,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 64; instruction.opcode = Opcode::AESDECWIDE256KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8648,6 +8652,7 @@ fn unlikely_operands::Address, ::Address, ::Address, ::Address, ::Address, { let modrm = read_modrm(words)?; let r = (modrm >> 3) & 7; + instruction.mem_size = 63; match r { 0b000 => { if modrm >= 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 48; instruction.opcode = Opcode::AESENCWIDE128KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8449,6 +8451,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 48; instruction.opcode = Opcode::AESDECWIDE128KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8457,6 +8460,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 64; instruction.opcode = Opcode::AESENCWIDE256KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8465,6 +8469,7 @@ fn unlikely_operands::Address, = 0b11_000_000 { return Err(DecodeError::InvalidOperand); } + instruction.mem_size = 64; instruction.opcode = Opcode::AESDECWIDE256KL; instruction.operands[0] = read_M(words, instruction, modrm)?; return Ok(()); @@ -8479,6 +8484,7 @@ fn unlikely_operands::Address, ::Address, ::Address, ::Address,