diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/long_mode/operand.rs | 3 | ||||
-rw-r--r-- | test/protected_mode/operand.rs | 4 | ||||
-rw-r--r-- | test/real_mode/operand.rs | 7 |
3 files changed, 12 insertions, 2 deletions
diff --git a/test/long_mode/operand.rs b/test/long_mode/operand.rs index 4cdaf35..a47e6c8 100644 --- a/test/long_mode/operand.rs +++ b/test/long_mode/operand.rs @@ -45,4 +45,7 @@ fn test_implied_memory_width() { assert_eq!(mem_size_of(&[0x66, 0x58]), Some(8)); assert_eq!(mem_size_of(&[0xff, 0xf0]), Some(8)); assert_eq!(mem_size_of(&[0x66, 0xff, 0xf0]), Some(2)); + // operand-size prefixed call and jump still reads 8 bytes (prefix ignored) + assert_eq!(mem_size_of(&[0x66, 0xff, 0x10]), Some(8)); + assert_eq!(mem_size_of(&[0x66, 0xff, 0x20]), Some(8)); } diff --git a/test/protected_mode/operand.rs b/test/protected_mode/operand.rs index a114e69..6eb9ba5 100644 --- a/test/protected_mode/operand.rs +++ b/test/protected_mode/operand.rs @@ -43,4 +43,8 @@ fn test_implied_memory_width() { assert_eq!(mem_size_of(&[0x66, 0x58]), Some(4)); assert_eq!(mem_size_of(&[0xff, 0xf0]), Some(4)); assert_eq!(mem_size_of(&[0x66, 0xff, 0xf0]), Some(2)); + // unlike 64-bit mode, operand-size prefixed call and jump do have a different size: they read + // two bytes. + assert_eq!(mem_size_of(&[0x66, 0xff, 0x10]), Some(2)); + assert_eq!(mem_size_of(&[0x66, 0xff, 0x20]), Some(2)); } diff --git a/test/real_mode/operand.rs b/test/real_mode/operand.rs index e037fee..7f2b72e 100644 --- a/test/real_mode/operand.rs +++ b/test/real_mode/operand.rs @@ -1,5 +1,4 @@ -use yaxpeax_x86::real_mode::{InstDecoder, Operand, RegSpec}; -use yaxpeax_x86::MemoryAccessSize; +use yaxpeax_x86::real_mode::{InstDecoder}; #[test] fn test_implied_memory_width() { @@ -17,4 +16,8 @@ fn test_implied_memory_width() { assert_eq!(mem_size_of(&[0x66, 0x58]), Some(2)); assert_eq!(mem_size_of(&[0xff, 0xf0]), Some(2)); assert_eq!(mem_size_of(&[0x66, 0xff, 0xf0]), Some(4)); + // unlike 64-bit mode, operand-size prefixed call and jump do have a different size: they read + // four bytes. + assert_eq!(mem_size_of(&[0x66, 0xff, 0x10]), Some(4)); + assert_eq!(mem_size_of(&[0x66, 0xff, 0x20]), Some(4)); } |