From 475321a686f346ac51cded60384a903fa8e9fdf8 Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 11 Sep 2026 16:15:14 +0000 Subject: fix hvc immediate missing its upper four bits --- src/armv7/thumb.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/armv7') diff --git a/src/armv7/thumb.rs b/src/armv7/thumb.rs index dacf3dd..96b6b98 100644 --- a/src/armv7/thumb.rs +++ b/src/armv7/thumb.rs @@ -2091,9 +2091,11 @@ pub fn decode_into::Address, ::Word>>(d // `HVC` (`B8-1970`) // v7VE let imm = lower & 0b1111_1111_1111; + let imm_upper = instr & 0b1111; + let imm = (imm_upper << 12) | imm; inst.opcode = Opcode::HVC; inst.operands = [ - Operand::Imm12(imm), + Operand::Imm32(imm as u32), Operand::Nothing, Operand::Nothing, Operand::Nothing, @@ -2818,7 +2820,7 @@ pub fn decode_into::Address, ::Word>>(d // TODO: so, this is gross! the PLD/PLI/PLT handling needs improvement across // the board. - if inst.opcode == Opcode::PLD { + if inst.opcode == Opcode::PLD || inst.opcode == Opcode::PLI { inst.operands[0] = inst.operands[1]; inst.operands[1] = Operand::Nothing; } -- cgit v1.1