rizin/test/db/analysis
Rot127 fb6efca4b5
[Hexagon] RzIL uplifiting (#3837)
Uplift Hexagon architecture to RzIL

The general structure is, that every (sub-)instruction has a getter for it's RzIL code.
Calling the getter will return the RzIL operation.
If RzIL for an instruction is requested, the plugin makes a decision. Because Hexagon only executes whole instruction packets. If the instruction is not the last instruction in a packet, it will simply return `EMPTY()`. If the RzIL for the last instruction in a packet is requested, it will get the RzIL operations for all instructions in the packet, shuffles them into the correct execution order (according to some rules) and returns the complete operation for the packet.

The RzIL code was entirely generated with the [rzil-compiler](https://github.com/Rot127/rzil-compiler/), using the semantic definition of the [QEMU Hexagon module](https://github.com/qemu/qemu/tree/master/target/hexagon).

Currently successful compile instructions (and tested):
```
[*] 1581/1733 standard instructions compiled.
[*] 431/643 HVX instructions compiled.
[*] In total: 2012/2376 instructions compiled.
```

It was tested with:
- (Semantic tests) `rz-tracetest` against the execution trace of the QEMU Hexagon test binaries.
- (Bug free and semi-semtantic test) Adding tests which simply execute the test binaries to ensure leak and segfault free execution. Also it is executed until a certain instruction is reached (end of `main` or `loc.pass` symbol), partially testing it executes correctly.

For the uplifting several changes and modernization had to be made:

- Enhance consistency of decoding
  - Allow to disassemble an instruction without copying the result. This is used if the given buffer of instruction bytes is larger than one instruction width. In this case, as many instructions as the buffer can hold are disassembled and buffered for later.
  - Generally enhance buffering of instructions.
  - Allow to mark a packet as valid before it is completely decoded (in case we know it must be valid, e.g. if it is a jump target of a valid packet).
- Fix (hopefully) all memory leaks of the Hexagon plugin.
- Changes to register getters, because RzIL needs finer control to translate alias or explicit register names to their real register.
  - Getter for register name is now done by table, so for future distinction between DSP version we can just select another table.
  - Translation functions from register alias or explicit name to their real register.
  - Each operand contains now it's variable ID (e.g. `d` for register `Rd`) as in the ISA (for mapping in the RzIL code).
- Ease debugging by tracking in more precision, if an instruction is added to a stale, active or new packet.
- Add registers `C20` - `C29` (not yet present in LLVM)
- Some renaming to make the code more readable.
2024-03-22 07:24:56 +00:00
..
6502 Updated all tests 2022-11-01 10:58:16 +08:00
8051 8051: Make Jump Targets in Higher Banks stay inside their Bank (#1066) 2021-04-23 13:14:51 +02:00
amd29k Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
arc Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
arm Fix string search related tests 2024-02-19 19:39:00 +08:00
arm64 Fix build with capstone v4 and v5 and disable hacks for v6 2024-03-08 12:33:07 +08:00
avr Update tests 2023-06-05 22:41:20 +08:00
chip8
classes Implement chained fixups patching for binds 2023-06-25 19:39:56 +08:00
cris Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
dalvik Analysis: sort function by address while printing (#4179) 2024-02-02 23:50:34 +08:00
gb Updated all tests 2022-11-01 10:58:16 +08:00
golang Fix arm64 analysis to fix regression on ARM64 switch tables. (#4284) 2024-02-24 00:00:12 +08:00
h8300 Updated all tests 2022-11-01 10:58:16 +08:00
hexagon [Hexagon] RzIL uplifiting (#3837) 2024-03-22 07:24:56 +00:00
i4004 Updated all tests 2022-11-01 10:58:16 +08:00
java Add bin.demangle.flags to allow users to simplify or not mangled strings (#3659) 2023-07-17 23:31:09 +08:00
luac Lua 5.3 support RzAsm + RzAnalysis 2021-04-14 16:22:15 +08:00
m68k Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
m680x Updated all tests 2022-11-01 10:58:16 +08:00
mach0 Fix all db/analysis tests 2021-10-27 09:31:50 +02:00
mcore Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
mips Update tests 2023-06-05 22:41:20 +08:00
msp430 Replace rz_core_cmd0 calls in tui/panels.c and port cmd_help commands to RzShell as cmd_math (#3421) 2023-03-30 18:36:48 +08:00
noreturn Fix all db/analysis tests 2021-10-27 09:31:50 +02:00
null Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
path Fixes for jump table ##analysis 2021-01-27 09:43:13 +08:00
pic Replace rz_core_cmd0 calls in tui/panels.c and port cmd_help commands to RzShell as cmd_math (#3421) 2023-03-30 18:36:48 +08:00
ppc Analysis: sort function by address while printing (#4179) 2024-02-02 23:50:34 +08:00
riscv Demangle flags symbols (#3915) 2023-10-20 09:33:30 +02:00
rl78 Fix tests with newly replaced symbol names. 2024-02-16 16:57:31 +08:00
rx Disassembler arch for RX microcontroller (MCU) family (#4198) 2024-02-17 22:29:16 +08:00
sh [RzIL] IL lifting of SuperH ISA (#2518) 2022-08-02 02:37:03 +05:30
snes
sparc Analysis: sort function by address while printing (#4179) 2024-02-02 23:50:34 +08:00
spc700 Updated all tests 2022-11-01 10:58:16 +08:00
sysz Remove RzAnalysisPlugin.set_reg_profile (#2091) 2021-12-11 10:18:31 +01:00
thumb ARM pseudo subvar: don't substitude [pc, reg] 2022-07-21 22:24:06 +02:00
tms320 Updated all tests 2022-11-01 10:58:16 +08:00
tms320.c64x_32 Merge rz_asm and rz_analysis into one library but keep deprecated apis. 2024-03-07 18:38:49 +08:00
tricore Analysis: sort function by address while printing (#4179) 2024-02-02 23:50:34 +08:00
v810 v810: RzIL support (#4096) 2024-01-14 10:45:48 +08:00
v850 v850: add local variables detection (#4271) 2024-02-20 00:08:03 +08:00
vars Add test for issue #329 2024-02-17 11:05:16 +08:00
x86_16 Update capstone instruction ids 2023-07-16 13:22:47 +08:00
x86_32 Analysis: sort function by address while printing (#4179) 2024-02-02 23:50:34 +08:00
x86_64 Analysis: sort function by address while printing (#4179) 2024-02-02 23:50:34 +08:00
xtensa Set refptr for Xtensa l32r opcode for better disassembly output (#3289) 2023-01-15 09:32:37 +08:00
z80 Updated all tests 2022-11-01 10:58:16 +08:00