diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/armv7.rs | 6 | ||||
| -rw-r--r-- | src/armv7/display.rs | 10 | ||||
| -rw-r--r-- | src/armv7/thumb.rs | 4 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/armv7.rs b/src/armv7.rs index 87b44f5..30a8960 100644 --- a/src/armv7.rs +++ b/src/armv7.rs @@ -775,6 +775,10 @@ pub enum Operand { BankedSPSR(Bank), /// a mask of bits for the `spsr` register. StatusRegMask(StatusRegMask), + /// a standalone rotate right by the specified amount. + /// + /// this typically applies equally to multiple operands; see `sxtah`, `uxtah`, etc. + Ror(u8), /// the `apsr` register. APSR, /// the `spsr` register. @@ -846,6 +850,8 @@ pub trait OperandVisitor { fn visit_banked_spsr(&mut self, bank: Bank) -> Result<Self::Ok, Self::Error>; /// process an operand that is some set of bits out of a status register. fn visit_status_reg_mask(&mut self, mask: StatusRegMask) -> Result<Self::Ok, Self::Error>; + /// process an operand that is a standalone rotate of other operands in the instruction. + fn visit_rotate(&mut self, amt: u8) -> Result<Self::Ok, Self::Error>; /// process an operand that is `APSR`. fn visit_apsr(&mut self) -> Result<Self::Ok, Self::Error>; /// process an operand that is `SPSR`. diff --git a/src/armv7/display.rs b/src/armv7/display.rs index 1398ce6..2d2a77c 100644 --- a/src/armv7/display.rs +++ b/src/armv7/display.rs @@ -357,6 +357,13 @@ impl<T: DisplaySink> crate::armv7::OperandVisitor for DisplayingOperandVisitor<' Ok(()) } + fn visit_rotate(&mut self, amt: u8) -> Result<Self::Ok, Self::Error> { + self.emit_shift_type(ShiftStyle::ROR)?; + self.f.write_char(' ')?; + self.f.write_prefixed_u16(amt as u16)?; + Ok(()) + } + fn visit_apsr(&mut self) -> Result<Self::Ok, Self::Error> { self.f.span_start_register(); self.f.write_fixed_size("apsr")?; @@ -1437,6 +1444,9 @@ impl super::Operand { Operand::StatusRegMask(mask) => { visitor.visit_status_reg_mask(mask) } + Operand::Ror(amt) => { + visitor.visit_rotate(amt) + } Operand::APSR => { visitor.visit_apsr() }, diff --git a/src/armv7/thumb.rs b/src/armv7/thumb.rs index 4340e95..1d9d96a 100644 --- a/src/armv7/thumb.rs +++ b/src/armv7/thumb.rs @@ -2860,7 +2860,7 @@ pub fn decode_into<T: Reader<<ARMv7 as Arch>::Address, <ARMv7 as Arch>::Word>>(d Operand::Reg(Reg::from_u8(rd)), Operand::Reg(Reg::from_u8(rm)), if rotate != 0 { - Operand::Imm32(rotate as u32) + Operand::Ror(rotate as u8) } else { Operand::Nothing }, @@ -2886,7 +2886,7 @@ pub fn decode_into<T: Reader<<ARMv7 as Arch>::Address, <ARMv7 as Arch>::Word>>(d Operand::Reg(Reg::from_u8(rn)), Operand::Reg(Reg::from_u8(rm)), if rotate != 0 { - Operand::Imm32(rotate as u32) + Operand::Ror(rotate as u8) } else { Operand::Nothing }, |
