From ce99ad8e8e5260f3a8bac896e14faf54f0df6c58 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 28 Sep 2021 19:48:39 -0700 Subject: fix various armv8 and armv8 panics that should be Err. in fact the decoder should _never_ panic. included here are tests that cover the entire 32-bit instruction space and ensure that decoding and display do not panic. these tests run uncomfortably slowly (1168s to decode the 4b "instruction" sequences on my desktop), but verify that panics are no longer an issue. --- test/armv8/a64.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/armv8') diff --git a/test/armv8/a64.rs b/test/armv8/a64.rs index 6dd9d9b..0e25c93 100644 --- a/test/armv8/a64.rs +++ b/test/armv8/a64.rs @@ -45,6 +45,13 @@ fn test_neon() { } #[test] +fn test_unpredictable() { + // could be stx/ldx but Lo1 is `x1` and invalid. + test_err([0x00, 0x00, 0x20, 0x08], DecodeError::InvalidOpcode); + test_err([0x00, 0xfc, 0x00, 0x12], DecodeError::InvalidOperand); +} + +#[test] fn test_display_misc() { test_display( [0xc0, 0x03, 0x5f, 0xd6], -- cgit v1.1