diff options
author | iximeow <me@iximeow.net> | 2021-12-19 09:06:12 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-12-19 09:09:20 -0800 |
commit | d13d8ebfad98b3d547f455ec9d73dab98f0899c3 (patch) | |
tree | 7abee6076688c087a2a45a84ae562f0cb59a8c94 /src | |
parent | 060fb29180f354e04ec8d48f0128433b634fa3c5 (diff) |
test that invalid RegSpec constructions panic as expected
in the process, fix 64-bit rex-byte limit, 32/16-bit mode mask reg limit
Diffstat (limited to 'src')
-rw-r--r-- | src/long_mode/mod.rs | 2 | ||||
-rw-r--r-- | src/protected_mode/mod.rs | 2 | ||||
-rw-r--r-- | src/real_mode/mod.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 866eb8f..7e8dff7 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -232,7 +232,7 @@ impl RegSpec { /// construct a `RegSpec` for non-rex byte reg `num` #[inline] pub fn rb(num: u8) -> RegSpec { - if num >= 18 { + if num >= 16 { panic!("invalid x86 rex-byte reg {}", num); } diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs index 232284d..9c03faf 100644 --- a/src/protected_mode/mod.rs +++ b/src/protected_mode/mod.rs @@ -179,7 +179,7 @@ impl RegSpec { /// construct a `RegSpec` for mask reg `num` #[inline] pub fn mask(num: u8) -> RegSpec { - if num >= 32 { + if num >= 8 { panic!("invalid x86 mask reg {}", num); } diff --git a/src/real_mode/mod.rs b/src/real_mode/mod.rs index 92c0592..74e1c37 100644 --- a/src/real_mode/mod.rs +++ b/src/real_mode/mod.rs @@ -179,7 +179,7 @@ impl RegSpec { /// construct a `RegSpec` for mask reg `num` #[inline] pub fn mask(num: u8) -> RegSpec { - if num >= 32 { + if num >= 8 { panic!("invalid x86 mask reg {}", num); } |