Commit Graph

216 Commits

Author SHA1 Message Date
Alexis Engelke
5bdafbbcf0 Fix VEX decoding with mandatory VEX.W bit
The Intel documentation is, well, inconsistent about this: at one point,
they say that the VEX.W prefix is ignored entirely in 32-bit mode, but
the instruction description indicates that a VEX.W can be required in
32-bit/compatibility mode as well.
2019-01-13 15:56:39 +01:00
Alexis Engelke
5532602000 Refactor prefix decoder 2019-01-13 15:54:47 +01:00
Alexis Engelke
4f4b2050c8 Allow prefix table at end of opcode
Some instructions, e.g. VZEROUPPER, have a prefix table but no
associated byte for that. Fix this by removing the prefix handling from
the table walking loop.
2019-01-13 15:53:48 +01:00
Alexis Engelke
d1110fae6a Handle address size overrides 2019-01-13 14:27:04 +01:00
Alexis Engelke
80458e3288 Reduce space required by instruction width 2019-01-13 14:26:26 +01:00
Alexis Engelke
c05b555bb0 Remove non-existing function from header 2019-01-13 13:18:24 +01:00
Alexis Engelke
fbc37b9514 Annotate generated table with comments 2019-01-13 13:15:28 +01:00
Alexis Engelke
ed53b4a54d Support 32 bit and 64 bit decoding with one binary
It is possible to configure the build process such that decoding of 32
bit and 64 bit instructions can be chosen at runtime using an additional
parameter of the decode function. The header file is now entirely
architecture-independent and no longer required any previous defines.

Decoding x86-64 still requires a 64-bit pointer size.
2019-01-13 11:58:59 +01:00
Alexis Engelke
83ea2f0769 Unify mnemonic table for 32 and 64 bit
As there is not much difference between the two mnemonic tables, it is
possible to unify them. As a consequence, the instruction types no
longer differ between 32 and 64 bit decodings.
2019-01-13 09:47:24 +01:00
Alexis Engelke
ec7d27302e Add some small benchmarks 2019-01-13 08:55:11 +01:00
Alexis Engelke
6b34f55855 Port test runner to python 2019-01-13 08:47:23 +01:00
Alexis Engelke
05493d4206 Refactor test driver to measure decoding time 2019-01-12 21:00:38 +01:00
Alexis Engelke
617ebe5c8a Decode additional CET instructions
Mainly motivated to decode binaries compiled by recent GCC versions,
which now include CET instructions like endbr64 all over the place.
2018-12-31 13:25:15 +01:00
Alexis Engelke
8063cb7401 Decode additional segment prefixes
This is mainly needed to handle the new control flow enforcement
extensions, making 3E a "notrack" prefix for indirect calls and jumps.

This is not (yet) modeled, and requires additional information on the
order of the prefixes, as 3E_66 (16-bit in ds segment) has a different
meaning than 66_3E (16-bit notrack). Before implementing this, an
analysis of the performance impact when decoding more prefix information
is probably required to avoid degrading overall performance for very few
and (as of now) seldomly used corner cases.
2018-12-31 13:23:42 +01:00
Alexis Engelke
ca54ca7422 Add compile-time option for architecture mode
This allows to decode x86-32 machine code on a 64-bit platform (but
not vice versa). As a side-effect, we also get rid of pointer-size
detection for architecture selection.
2018-12-25 17:06:47 +01:00
Alexis Engelke
a3f77dbf49 Initial commit 2018-04-08 13:45:13 +00:00