From b9384b6b6bcdc50efa9df73cd840eb8a49cda7ab Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 26 Jul 2026 07:40:17 +0000 Subject: untangle some nonconforming ld/st forms --- tests/armv7/mod.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/armv7/mod.rs b/tests/armv7/mod.rs index 7caaaf5..b5d5d17 100644 --- a/tests/armv7/mod.rs +++ b/tests/armv7/mod.rs @@ -100,7 +100,7 @@ fn test_arm_security_extensions(data: [u8; 4], expected: &'static str) { fn test_nonconformant(data: [u8; 4]) { let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let result = InstDecoder::default().decode(&mut reader); + let result = InstDecoder::default().allow_nonconforming(false).decode(&mut reader); assert!( result == Err(DecodeError::Nonconforming), "got bad result: {:?} from {:#x?}", result, data @@ -241,22 +241,23 @@ fn test_decode_str_ldr() { test_all([0xbb, 0x38, 0xf5, 0xe1], "ldrh r3, [r5, 0x8b]!"); test_armv5([0xdb, 0x40, 0xa6, 0xe1], "ldrd r4, r5, [r6, fp]!"); test_armv5_nonconforming([0xd0, 0x10, 0x00, 0x00], "ldrdeq r1, r2, [r0], -r0"); -// TODO: bits 8..11 are "should be 0", so this decodes only when admitting nonconforming + // bits 8..11 are "should be 0", so this decodes only when admitting nonconforming test_armv5_nonconforming([0xdb, 0x48, 0xa6, 0xe1], "ldrd r4, r5, [r6, fp]!"); test_armv5_nonconforming([0xdb, 0x38, 0xa5, 0xe1], "ldrd r3, r4, [r5, fp]!"); - test_invalid([0xdb, 0x30, 0xa5, 0xe1]); - test_invalid([0xfb, 0x30, 0xe5, 0xe1]); + test_armv5_nonconforming([0xdb, 0x30, 0xa5, 0xe1], "ldrd r3, r4, [r5, fp]!"); + test_armv5_nonconforming([0xfb, 0x30, 0xe5, 0xe1], "strd r3, r4, [r5, 0xb]!"); test_all([0xdb, 0x30, 0xb5, 0xe1], "ldrsb r3, [r5, fp]!"); - test_all([0xdb, 0x38, 0xb5, 0xe1], "ldrsb r3, [r5, fp]!"); + test_armv5_nonconforming([0xdb, 0x38, 0xb5, 0xe1], "ldrsb r3, [r5, fp]!"); test_armv5([0xdb, 0x48, 0xe6, 0xe1], "ldrd r4, r5, [r6, 0x8b]!"); - test_invalid([0xdb, 0x38, 0xe5, 0xe1]); + test_armv5_nonconforming([0xdb, 0x38, 0xe5, 0xe1], "ldrd r3, r4, [r5, 0x8b]!"); test_all([0xdb, 0x38, 0xf5, 0xe1], "ldrsb r3, [r5, 0x8b]!"); test_all([0xfb, 0x40, 0xa6, 0xe1], "strd r4, r5, [r6, fp]!"); -// TODO: bits 8..11 are "should be 0", so this decodes only when admitting nonconforming + // bits 8..11 are "should be 0", so this decodes only when admitting nonconforming test_all_nonconforming([0xfb, 0x48, 0xa6, 0xe1], "strd r4, r5, [r6, fp]!"); test_all_nonconforming([0xfb, 0x38, 0xa5, 0xe1], "strd r3, r4, [r5, fp]!"); - test_all([0xfb, 0x38, 0xb5, 0xe1], "ldrsh r3, [r5, fp]!"); - test_invalid([0xfb, 0x38, 0xe5, 0xe1]); + test_all_nonconforming([0xfb, 0x38, 0xb5, 0xe1], "ldrsh r3, [r5, fp]!"); + test_all([0xfb, 0x30, 0xb5, 0xe1], "ldrsh r3, [r5, fp]!"); + test_all_nonconforming([0xfb, 0x38, 0xe5, 0xe1], "strd r3, r4, [r5, 0x8b]!"); test_all([0xfb, 0x48, 0xe6, 0xe1], "strd r4, r5, [r6, 0x8b]!"); test_all([0xfb, 0x38, 0xf5, 0xe1], "ldrsh r3, [r5, 0x8b]!"); test_all([0xfb, 0x38, 0xff, 0xe1], "ldrsh r3, [pc, 0x8b]!"); -- cgit v1.1