165 Commits

Author SHA1 Message Date
Alexis Engelke c13eb03b0e basicblock: Unify register file creation 2024-05-10 12:10:20 +02:00
Alexis Engelke 8512a68739 rellume: Remove ll_func_add_instr
This is just redundant functionality of ll_func_decode_instr.
2024-01-06 12:25:04 +01:00
Alexis Engelke 8fa83d8f34 function: Store code address ranges
This allows to follow, which instruction bytes were used during lifting.
2024-01-05 20:31:11 +01:00
Alexis Engelke 30249616f1 callconv: Drop HHVM
Upstream LLVM dropped hhvmcc in version 17.
2023-12-20 13:41:30 +01:00
Alexis Engelke 49d66df944 arch: Add AArch64 basic definitions
Originally authored by Dominik Okwieka.
2022-01-29 10:17:16 +01:00
Alexis Engelke b783e66998 transforms: Remove long-deprecated functions
These functions are almost entirely useless or incorrect; optimization
is better handled with the new pass manager, and the SysV ABI
transformation was incomplete and buggy.
2022-01-14 13:02:38 +01:00
Alexis Engelke 63f62eefcf function: Allow to individually add instructions 2022-01-04 17:22:28 +01:00
Alexis Engelke 81f55be6ae rellume: Allow generating PIC via relocations
As the difference between the PC value during lifting and execution must
be known, it is possible to use absolute value relocations to avoid
dynamic computations of addresses.
2021-11-04 13:31:32 +01:00
Alexis Engelke 0c7dec2bfc rellume: Deprecate explicit instruction overrides 2021-02-11 19:20:49 +01:00
Alexis Engelke f257a79aa8 rellume: Add configuration for cpuinfo function
This is used by the x86-64 to handle CPUID.
2021-02-11 19:20:49 +01:00
Alexis Engelke b31b29587b general: Allow disabling architectures
With the increasing number of supported architectures, an option to
disable specific lifters allows to reduce dependencies.
2021-02-11 15:31:50 +01:00
Alexis Engelke 38b436120c rellume: Remove Fadec dependency from API 2021-02-11 14:32:01 +01:00
Alexis Engelke 2f40d1f59b rellume: Remove deprecated ll_func_add_inst
It is more reliable to encode an instruction and decode it again using
ll_func_decode_instr, especially given that Fadec does not give any
guarantees on ABI compatibility.
2021-02-11 14:29:28 +01:00
Alexis Engelke 186ea68e79 rv64: Add initial lifter for 64-bit RISC-V 2020-12-04 14:05:01 +01:00
Dominik Okwieka 6e31ce1f6f rellume: Add ll_config_set_architecture
It takes a string describing the architecture. This way, we do not
expose the internal Arch enum needlessly. The valid option is
"x86-64".
2020-11-24 16:07:40 +01:00
Alexis Engelke ff47a45c0e rellume: Deprecate add_inst function 2020-07-13 13:19:44 +02:00
Alexis Engelke 63890f2996 regfile: Make full facet propagation optional 2020-03-29 13:14:03 +02:00
Alexis Engelke 78e28e0ec2 general: Support lifting call/ret to call/ret
This adds two new configuration options: a function to use for tail
continuations and a function to use for function calls.

When a tail continuation function is specified, the exit block does not
return but performs a `musttail` call to that function. Tail
continuation is only performed once in the exit block.

When a call function is given, a CALL instruction will generate a call
to that function (setting RIP accordingly). The CFG decoder will assume
that the function is likely to return and continue decoding after a CALL
instruction. However, it will verify that the RIP matches and otherwise
return/tail continue. When CALL is lifted to an LLVM-IR call, a RET will
be forcefully lifted as LLVM-IR return, regardless of whether tail
continuation is enabled. This may lead to multiple returns in addition
to the single exit block.
2020-03-22 17:43:12 +01:00
Alexis Engelke bf008a3a83 lifter: Make instruction marker configurable
This allows a user-specified function to be called as instruction
marker. Further, this change makes markers much more usable: they get
the current instruction pointer and the decoded FdInstr string as
metadata.
2020-03-15 12:36:00 +01:00
Alexis Engelke 0414d8e13c rellume: Allow setting syscall handler explicitly
This removes the previous workaround to set specific registers even if
the SYSCALL implementation was overriden. Now there is a special
function override dedicated to only provide syscall semantics, but is
not required to set RCX and R11 as mandated by the ISA.
2020-03-15 12:08:45 +01:00
Alexis Engelke 55c2571c73 function: Support lifting code as PIC 2020-03-07 14:38:13 +01:00
Alexis Engelke 7bd8174f2b rellume: Deprecate transformations 2020-02-20 14:05:42 +01:00
Alexis Engelke cc47757371 rellume: Remove legacy decode functions 2020-02-20 13:52:24 +01:00
Alexis Engelke ad18dece65 lifter: Move opcode definitions to lifter 2020-02-20 12:15:24 +01:00
Alexis Engelke bd35a71b7d instr: Drop public header 2020-02-20 12:07:53 +01:00
Alexis Engelke 7a794a856d instr: Make LLReg structure internal 2020-02-20 12:06:16 +01:00
Alexis Engelke 4f9cd90d3c instr: Drop LL_RI_* enumeration 2020-02-20 12:03:01 +01:00
Alexis Engelke f313ea5a26 instr: Drop LL_RT_* enumeration 2020-02-20 12:00:10 +01:00
Alexis Engelke 15ef991ccb instr: Drop LL_RT_IP 2020-02-20 11:38:59 +01:00
Alexis Engelke c8243b3491 instr: Use Fadec instruction mnemonics 2020-02-20 11:30:35 +01:00
Alexis Engelke ee91cf0b46 gp: No longer model REP* as separate instructions 2020-02-19 17:04:36 +01:00
Alexis Engelke 766042acbd instr: Remove custom instruction structure 2020-02-19 16:55:10 +01:00
Alexis Engelke 18863956f4 rellume: Only accept Fadec instruction in API 2020-02-19 13:56:38 +01:00
Alexis Engelke a910b1985a instr: Move class to internal header file 2020-02-19 13:44:55 +01:00
Alexis Engelke a417493e3b instr: Wrap struct with class 2020-02-19 13:40:47 +01:00
Alexis Engelke affbaf46dd gp: Refactor code for ADD/ADC/SUB/SBB/CMP/XADD 2020-02-11 11:14:00 +01:00
Alexis Engelke a3f1079717 instr: Drop size encoding and C++ API in LLReg
Register sizes are either encoded in operand sizes or overridden via
facets. There is no need to carry redundant information.

Note: This change BREAKS API AND ABI.
Note #2: It is probably easier not expose the instruction structs.
2020-02-10 18:03:35 +01:00
Alexis Engelke 3d53ef1811 instr: Drop constructors for LLInstrOp 2020-02-10 17:16:57 +01:00
Alexis Engelke a32b0c9e44 instr: Add function to query control flow flags 2020-01-25 19:07:45 +01:00
Alexis Engelke 921309381d lifter: Implement LAHF/SAHF 2020-01-25 16:33:54 +01:00
Alexis Engelke ec783ebefe instr: Move X86Reg to register file 2020-01-25 16:05:31 +01:00
Alexis Engelke 5456833785 instr: Move X86Reg mapping to Lifter 2020-01-08 11:21:26 +01:00
Alexis Engelke 9e88643a5e general: Some refactoring to use X86Reg 2020-01-07 16:26:18 +01:00
Alexis Engelke e36045b335 callconv: Use X86Reg for sptr description 2020-01-07 09:53:47 +01:00
Alexis Engelke 4af16bcd48 regfile: Use new X86Reg for register identification
The operand representation of registers allows multiple representations
to map the same register in a non-obvious way. For the register file,
use a new, stripped down representation containing only the registers
which are actually contained in the register file.
2020-01-06 22:23:43 +01:00
Alexis Engelke f92405aea9 gp: Handle UD2 as unreachable 2020-01-06 17:04:52 +01:00
Alexis Engelke b906bb946a gp: Support POPFQ 2020-01-06 16:47:02 +01:00
Alexis Engelke 9615dfd949 callconv: Make Sptr address space configurable 2020-01-06 13:46:22 +01:00
Alexis Engelke 702050f9ad sse: Add non-temporal hint to MOVNT* stores 2020-01-03 15:55:14 +01:00
Alexis Engelke c8c236562c gp: Support XLATB 2020-01-02 11:45:47 +01:00