From 03b7860359a9bdff793419367563974db335e45e Mon Sep 17 00:00:00 2001 From: Grond Date: Mon, 22 Jun 2026 13:03:32 -0700 Subject: Check all of the appropriate bits when parsing op1 for CDP2/MCR2/MRC2 --- src/armv7.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/armv7.rs') diff --git a/src/armv7.rs b/src/armv7.rs index ada486a..2901508 100644 --- a/src/armv7.rs +++ b/src/armv7.rs @@ -1492,6 +1492,17 @@ impl Decoder for InstDecoder { } } 0b11 => { + // We know the instruction looks like this... + // |1 1 1 1|1 1 1|x x x x|x|x x x x|x x x x|x x x x x|x x|x|x x x x| + // ^ We need to check that this bit is zero, if any of the + // instructions decoded in this block are to match + // correctly. + // See A5-214 for the table that shows the required forms for these + // instructions. + if (op1 >> 4) & 1 != 0 { + return Err(DecodeError::InvalidOpcode); + } + // operands are shared between cdp2 and mcr2/mrc2, but Rt is repurposed as // CRd let CRm = word as u8 & 0b1111; -- cgit v1.1