diff options
author | iximeow <me@iximeow.net> | 2019-12-16 01:02:56 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 16:10:14 -0800 |
commit | a245487fa29f7e132f6f2c42d84bdaf5fc099922 (patch) | |
tree | d900102ad44671fddc0df8db1fb585ade4adc9b4 /test | |
parent | f23d12996aeb4f6e1dbf65e4c8e39376303425c8 (diff) |
support aesni
this includes respecting ModRM_XXXX-style operand codes from alternate
0f opcode maps. this MAY introduce bugs where an opcode 0fXX is valid
by the 0f map, invalid by the 660f map, and we see a sequence like
660fXXYY. if YY results in 0fXX being invalid by 660f, we may have to
fall back to reading opcode XX as an 0f opcode, where YY needs to be
re-read with the correct operand code.
hopefully this doesn't actually happen...
Diffstat (limited to 'test')
-rw-r--r-- | test/test.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test.rs b/test/test.rs index e2c52fe..cd2f6c0 100644 --- a/test/test.rs +++ b/test/test.rs @@ -98,6 +98,38 @@ fn test_cvt() { } #[test] +fn test_aesni() { + fn test_instr(bytes: &[u8], text: &'static str) { + test_display_under(&InstDecoder::minimal().with_aesni(), bytes, text); + test_display_under(&InstDecoder::default(), bytes, text); + test_invalid_under(&InstDecoder::minimal(), bytes); + } + + fn test_instr_invalid(bytes: &[u8]) { + test_invalid_under(&InstDecoder::minimal().with_aesni(), bytes); + test_invalid_under(&InstDecoder::default(), bytes); + } + + test_instr(&[0x66, 0x0f, 0x38, 0xdb, 0x0f], "aesimc xmm1, [rdi]"); + test_instr(&[0x66, 0x4f, 0x0f, 0x38, 0xdb, 0xcf], "aesimc xmm9, xmm15"); + + test_instr(&[0x66, 0x0f, 0x38, 0xdc, 0x0f], "aesenc xmm1, [rdi]"); + test_instr(&[0x66, 0x4f, 0x0f, 0x38, 0xdc, 0xcf], "aesenc xmm9, xmm15"); + + test_instr(&[0x66, 0x0f, 0x38, 0xdd, 0x0f], "aesenclast xmm1, [rdi]"); + test_instr(&[0x66, 0x4f, 0x0f, 0x38, 0xdd, 0xcf], "aesenclast xmm9, xmm15"); + + test_instr(&[0x66, 0x0f, 0x38, 0xde, 0x0f], "aesdec xmm1, [rdi]"); + test_instr(&[0x66, 0x4f, 0x0f, 0x38, 0xde, 0xcf], "aesdec xmm9, xmm15"); + + test_instr(&[0x66, 0x0f, 0x38, 0xdf, 0x0f], "aesdeclast xmm1, [rdi]"); + test_instr(&[0x66, 0x4f, 0x0f, 0x38, 0xdf, 0xcf], "aesdeclast xmm9, xmm15"); + + test_instr(&[0x66, 0x0f, 0x3a, 0xdf, 0x0f, 0xaa], "aeskeygenassist xmm1, [rdi], 0xaa"); + test_instr(&[0x66, 0x4f, 0x0f, 0x3a, 0xdf, 0xcf, 0xaa], "aeskeygenassist xmm9, xmm15, 0xaa"); +} + +#[test] fn test_sse3() { fn test_instr(bytes: &[u8], text: &'static str) { test_display_under(&InstDecoder::minimal().with_sse3(), bytes, text); |