Commit Graph

49 Commits

Author SHA1 Message Date
Alexis Engelke
c87264ace3 instrs: Add MMX PSHUFW instruction 2021-01-10 14:02:39 +01:00
Alexis Engelke
dd4263b169 instrs: Support far jumps/calls encoded target 2021-01-10 12:31:07 +01:00
Alexis Engelke
96e513c8ea breaking! instrs: Decode VMOVS[SD] loads correctly
These instruction ignore the VEX operand if the source operand is a
memory location.

API compatibility: separate handling for different operand types in the
second and third operand (REG+REG vs. MEM+NONE) is needed.
2021-01-10 12:12:26 +01:00
Alexis Engelke
e86ea540b5 instrs: Fixup register decoding for PEXTR* 2021-01-10 12:11:27 +01:00
Alexis Engelke
111769832f format: Properly output VSIB encodings 2021-01-08 10:37:13 +01:00
Alexis Engelke
3fdbd70153 encode: Fix erroneous encoding of high registers 2021-01-07 10:03:17 +01:00
Alexis Engelke
44808e7b1a format: Format instructions with Intel syntax 2021-01-03 21:18:57 +01:00
Alexis Engelke
d8c7ee94b7 instrs: Minor fixes to operand sizes 2021-01-03 20:08:34 +01:00
Alexis Engelke
d2bf961b77 instrs: Properly handle PUSH/POP of SEG registers 2021-01-03 20:08:34 +01:00
Alexis Engelke
aa1a39bd9d instrs: Check SREG validity using modreg table 2020-11-29 11:56:08 +01:00
Alexis Engelke
8976c7141a decode: Fix erroneous decoding of high-byte regs 2020-11-28 13:54:19 +01:00
Alexis Engelke
bb8510d77f decode: Ignore ES/CS/SS/DS override in 64-bit mode 2020-11-22 20:59:13 +01:00
Alexis Engelke
ad1f1e39c3 decode: Minor non-functional changes 2020-11-22 15:14:57 +01:00
Alexis Engelke
6fe5500444 instrs: Force RIP access to 64-bit and fix XBEGIN 2020-11-22 15:13:52 +01:00
Alexis Engelke
bbc3b34f71 decode: Fix VEX + REX + legacy combinations 2020-11-21 15:43:51 +01:00
Alexis Engelke
7f0bd4de8b decode: Fix combinations of VEX with legacy prefix 2020-11-21 14:59:25 +01:00
Alexis Engelke
95070908d0 tests/decode: Add more test cases 2020-11-09 09:47:36 +01:00
Alexis Engelke
58464d6fa1 decode: Fix ignoring VEX.B in 32-bit mode 2020-11-09 09:47:36 +01:00
Alexis Engelke
2e7e396325 decode: Remove TABLE_PREFIX_REP and use NFx prefix 2020-11-09 09:47:36 +01:00
Alexis Engelke
69ce124354 encode: Add library for x86-64 encoding 2020-11-09 09:46:38 +01:00
Alexis Engelke
4e95c8d152 instrs: Several operand size and AVX-related fixes 2020-07-05 14:59:24 +02:00
Alexis Engelke
dc668691d8 instrs: Specify segment register size 2020-07-04 14:25:22 +02:00
Alexis Engelke
da4ad137d8 instrs: Remove redundant IMM_8 2020-07-04 08:55:51 +02:00
Alexis Engelke
e7b5982ba9 tests/decode: Add CRC32 and MOVBE test cases 2020-06-27 19:01:26 +02:00
Alexis Engelke
ab27ea6338 tests/decode: Print architecture mode on failure 2020-06-27 19:01:26 +02:00
Alexis Engelke
ceea786c7f tests/decode: Rewrite in C, speed-up is >100x 2020-06-27 19:01:26 +02:00
Alexis Engelke
3221a319d3 instrs: Don't use O-encoding hack for FSTSW 2020-06-27 17:33:58 +02:00
Alexis Engelke
5e1bb1871f decode: Check CR/DR/SEG reg count in ModRM decoder 2020-06-27 17:33:58 +02:00
Alexis Engelke
bb4b195dbe instrs/sse,avx: Fix several operand sizes 2020-06-25 21:04:10 +02:00
Alexis Engelke
545ec30ad0 decode: Return partial error on incomplete opcode 2020-06-14 14:01:39 +02:00
Alexis Engelke
8716bd1991 format: Handle offset operands properly 2020-06-14 14:01:14 +02:00
Alexis Engelke
80ec7ed960 instrs: Fix decoding of XCHG r8, rax
Opcode 90 is only a NOP if there is no REX.B.
2020-06-14 13:36:11 +02:00
Alexis Engelke
dc286b14f2 Unify instruction mnemonics [API break]
It is a longer standing issue that some instructions like ADD, IMUL, and
SHL have multiple mnemonics for different encoding forms. This is a
relict from a time where such information was not stored in the
instruction decoding. This, however, is no longer the case and therefore
the extra mnemonics just increase the number of cases to be handled by
users.
2020-02-20 10:56:17 +01:00
Alexis Engelke
513a913feb decode: Store CL as register operand for shifts 2020-02-19 16:53:59 +01:00
Alexis Engelke
f6a66ea4fb Use special root table for VEX
Some instruction opcodes have an entirely different encoding when a VEX
prefix is present. For example, 0f41 is CMOVNO without mandatory
prefixes while VEX.NP.W0.L1.0f41 is KANDW with a mandatory prefix. To
avoid collisions, the VEX prefix is better handled as a completely
separate decode tree, at the cost of a slight increase in table size.
2020-02-10 20:34:37 +01:00
Alexis Engelke
2933b0f106 Rename library to libfadec 2019-06-16 09:44:12 +02:00
Alexis Engelke
83988828ec Add some test cases for ModRM decoding 2019-02-24 10:10:02 +01:00
Alexis Engelke
dfd70eef39 Fix bug with VMOV[DQ] operand width in 32-bit mode 2019-02-24 10:09:18 +01:00
Alexis Engelke
3abf29d63e Major rework of API and improved documentation 2019-01-23 20:03:40 +01:00
Alexis Engelke
20f6e8c073 Fix handling of 66h prefix on jumps
It turns out that in x86-64 mode, address and operand size overrides are
ignored by the processor. (Tested that on a real machine.)

Even libopcodes gets this wrong...
2019-01-14 19:53:46 +01:00
Alexis Engelke
a799024066 Specify address via parameter
This allows to decode instructions where the address of the buffer is
not the address of the instruction.
2019-01-14 19:52:03 +01:00
Alexis Engelke
55f6fda583 Add some test cases for prefix ordering 2019-01-13 20:39:57 +01:00
Alexis Engelke
8fdfe53822 Output more available information in formatter
The formatter now includes the following information:

- Segment overrides
- Address-size overrides
- REP/REPNZ prefixes
- LOCK prefix
- High-byte registers (determined using presence of REX prefix)
2019-01-13 20:38:15 +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
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
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