diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/long_mode/mod.rs | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 8772882..2f4b799 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -7122,6 +7122,35 @@ fn read_operands< return Ok(()); } + if operand_code.has_imm() { + if operand_code.operand_case_handler_index() == OperandCase::Ibs { + instruction.imm = + read_imm_signed(words, 1)? as u64; + sink.record( + words.offset() as u32 * 8 - 8, + words.offset() as u32 * 8 - 1, + InnerDescription::Number("1-byte immediate", instruction.imm as i64) + .with_id(words.offset() as u32 * 8), + ); + instruction.operands[0] = OperandSpec::ImmI8; + } else { + instruction.imm = + read_imm_signed(words, 4)? as u64; + sink.record( + words.offset() as u32 * 8 - 32, + words.offset() as u32 * 8 - 1, + InnerDescription::Number("4-byte immediate", instruction.imm as i64) + .with_id(words.offset() as u32 * 8), + ); + if instruction.opcode == Opcode::CALL { + instruction.mem_size = 8; + } + instruction.operands[0] = OperandSpec::ImmI32; + } + instruction.operand_count = 1; + return Ok(()); + } + let mut modrm = 0; let mut opwidth = 0; let mut mem_oper = OperandSpec::Nothing; @@ -7166,35 +7195,6 @@ fn read_operands< instruction.operands[1] = mem_oper; } - if operand_code.has_imm() { - if operand_code.operand_case_handler_index() == OperandCase::Ibs { - instruction.imm = - read_imm_signed(words, 1)? as u64; - sink.record( - words.offset() as u32 * 8 - 8, - words.offset() as u32 * 8 - 1, - InnerDescription::Number("1-byte immediate", instruction.imm as i64) - .with_id(words.offset() as u32 * 8), - ); - instruction.operands[0] = OperandSpec::ImmI8; - } else { - instruction.imm = - read_imm_signed(words, 4)? as u64; - sink.record( - words.offset() as u32 * 8 - 32, - words.offset() as u32 * 8 - 1, - InnerDescription::Number("4-byte immediate", instruction.imm as i64) - .with_id(words.offset() as u32 * 8), - ); - if instruction.opcode == Opcode::CALL { - instruction.mem_size = 8; - } - instruction.operands[0] = OperandSpec::ImmI32; - } - instruction.operand_count = 1; - return Ok(()); - } - if let Some(z_operand_code) = operand_code.get_embedded_instructions() { let reg = z_operand_code.reg(); match z_operand_code.category() { |