Commit graph

97 commits

Author SHA1 Message Date
Anton Kochkov
ab201a3843 arch/tms320: TMS320C55x+ analysis & RzIL (PR #6434) + extended lifter coverage
Squash of rizinorg/rizin PR #6434 ("improve TMS320C55x+ analysis and RzIL")
rebased onto dev, with the PR head's doubled c55plus_il.c (every symbol defined
twice, failing to compile) de-duplicated to a single clean copy.

Substantially extends the C55x/C55x+ RzIL lifter over the existing structured-
operand helpers: mov/copy (immediate, register, memory load/store, half-register
read-modify-write), the full addressing-mode set with post-modify side effects,
control and system-register moves, 40-bit accumulator ALU with shifted sources,
16-bit and dual-memory add/sub, the ST0_55 status-flag model (cmp/cmpand/rol/ror,
named-bit bset/bclr), a documented psh/pop stack model, address-unit amov/aadd/
asub and amar, and bcc/callcc control transfer. The multiply/MAC family and satr
are lifted with explicit, documented integer-mode approximations (not verified
DSP semantics); irreducibly multi-output primitives (bit counts, Viterbi, FIR,
distance) are left correct-or-NULL. The register file covers ac0-7 and xar, found
by validating on real Motorola Wrigley C55x+ firmware whose prologues save 40-bit
accumulators as dbl(acN)+acN.g pairs.

Adds RzIL-VM emulation tests (including the C55x and C55x+ _decrypt emulateme
binaries), per-instruction IL assertions, and ~95% instruction-class disassembly
coverage per corpus; pins little-endian in the VM tests for big-endian hosts; and
regenerates the analysis expectations against current dev.
2026-06-15 23:31:05 +08:00
Anton Kochkov
a2454fec15 librz/arch/vax: add new LGPL DEC VAX-11 disassembler and analysis plugin
Add a new LGPL-3.0 VAX-11 architecture plugin that replaces the removed
binutils-derived GPL one. It is written from scratch from the documented
VAX operand-specifier encoding and does not reuse any GPL code.
2026-06-13 18:58:55 +08:00
Dmitry Opokin
423576676b
librz/arch: MIL-STD-1750 ISA support (#6042) 2026-06-11 12:53:58 +08:00
NOT XVilka
9632328f74
Add χ² , index of coincidence, min-entropy, serial correlation statistical indicators (#6466)
* hash: add chi-square (vs uniform) rz-hash plugin

Adds a chi-square goodness-of-fit (vs a uniform byte distribution)
statistic as an rz-hash plugin and the rz_hash_chisquare() API.

Unlike Shannon entropy, chi-square separates high-entropy data that is
truly uniform (encryption/CSPRNG, ~255) from high-entropy data that is
merely compressed or packed (much larger values), which is a common
question when triaging firmware blobs.

* hash: add index-of-coincidence rz-hash plugin

Adds the index of coincidence as an rz-hash plugin and the
rz_hash_ioc() API. IoC is ~1/256 for uniform data and markedly higher
for text, padding, single-byte-XOR'd data and repeating-key regions;
computed at several strides it is the Friedman/Kasiski test for a
repeating-XOR period.

* hash: add min-entropy rz-hash plugin

Adds min-entropy H_inf = -log2(max_i p_i) as an rz-hash plugin and the
rz_hash_min_entropy() API. This is the conservative worst-case entropy
used by NIST SP 800-90B: 8.0 for a uniform block, dropping as soon as a
single byte value dominates.

* hash: add serial-correlation rz-hash plugin

Adds the lag-1 serial correlation coefficient (with wrap-around, as in
the classic `ent` tool) as an rz-hash plugin and the
rz_hash_serial_correlation() API. Near 0 for compressed/encrypted data
but clearly non-zero for executable code, counters and gradients - the
order-aware axis that the histogram-only metrics cannot see.

---------

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-08 00:20:15 +08:00
SSharshunov
ea370203ed
Support Siemens/Infineon C16x microcontroller (#6321) 2026-05-12 21:17:37 +08:00
Cheese Cake
85cbb92b22
hash: add fnv1a algorithm (#6186) 2026-04-09 19:05:02 +08:00
SSharshunov
fcfb984235
Luac 5.0-5.5 support (#6142) 2026-04-05 08:12:55 +08:00
Shessaanand Siva Sivamurugan
7ad49c41c2
hash: add jenkins non-cryptographic hash (#6121) 2026-04-02 01:42:23 +08:00
cheese-cakee
ca2fd3b954
hash: add xxhash64 algorithm (#6098) 2026-03-28 05:16:44 +08:00
Ashish Kumar
f6344debf8
librz/hash: add murmur3 hash function (without keys support) (#6002) 2026-03-25 15:46:37 +08:00
Jagath P
3e39942e70
Added disassembly support for cBPF (#5988)
* Added disassembly support for BPF

* Added the analysis plugin file and test file for classic bpf
2026-03-24 16:56:25 +00:00
Giovanni
d2494fac4a
librz/bin/{coff,ecoff}: fix various Coverity issues (#6023)
* Fix Coverity issues on ecoff
* Fix Alpha bitness
* Fix memleak in coff.c
* Fix tests
2026-03-13 00:44:59 +08:00
Ayush
5fab5584e2
librz/bin: add CaRT container format support (#5964)
* Add CaRT extractor plugin
* Update cmd_list expected output for CaRT extractor plugin

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-03-07 20:51:50 +08:00
Farhan Saiyed
e4464a1c55
blake2 hash support (#5995) 2026-03-06 22:17:59 +08:00
Anton Angelov
95f94ae258
refactor: SwissTable implementation for ht (#5860)
* Add ht benchmarks
* Initial implementation
* Finalize native per-group lookup support
* Lookup SSE2 implementation
* Improve hashing
* Add support for custom elem_size
* Avoid double h2 hashing when reserving slot
* Make custom elem_size support conditional
* Fix issues with bitwise and default lookup implementations
* Implement deletion trick optimization
* Track growth_size instead of deleted_slots
* Refactor SDB to access ht via API instead of internals
* Modify SDB tests which rely on hashtable order
* Fix SDB build warnings
* Fix bug with finding next power of two
* foreach_kv to return a bool result
* Change SDB diff order expected by serialize_analysis unit test
* Fix bug in the bitwise lookup implementation
* Remove second call to rz_core_init() which causes memory leaks
* Update some regression tests to accept reordered output
* Adapt ht clear to new implementation
* Use fini_kv_pair and fix 1 potential leak on malloc failure
* Fix cmd/types test after merge
* Avoid second call to calsize_key and avoid iter leaks on malloc failure
* Improve hash distribution
* Extend benchmark suite
* Fix bug with string hashing
* Branchless write to mirrored ctrl bytes
* Simplify string hash and remove potential UB
* Move RZ_PREFETCH macro to rz_types.h
* Add SSE2 discovery in Meson
* Forward SDB string hash function to ht string hash
* Try to revert test_cpu_profiles() to avoid relying on a baked SDB file
* Revert SDB/CDB hash function change
* Fix SDB reference to HT hash function instead of CDB hash
* Change calloc to malloc
* Avoid storing/checking key_len and key_value if they are ut64
* Improve string hash function
* Rename default hash functions
* Improve bench code
* linter.yml: set clang-path to point to llvm-18
2026-03-02 12:31:35 +08:00
Giovanni
00fba1dd53
Add support to MIPS & Alpha ECOFF 32/64 (#5447) 2026-02-28 23:37:55 +08:00
Ashish Kumar
732a5d6185
librz/hash: Add sha3 (incl. keccak) support (#5886) 2026-02-28 20:16:13 +08:00
StefBisti
176c071603
Add amiga hunk format support (#5911) 2026-02-22 22:07:09 +08:00
مصطفي محمود كمال الدين
158765163a
librz/arch: rewrite the RISC-V support to use Capstone (#5482)
* remove GNU plugin and remove the pseudo-assembly test
* modernize Capstone-based RISC-V plugin and add huge test coverage
2026-02-17 03:35:37 +08:00
Farhan Saiyed
3a68ec601d
librz/bin: PEF support (#5921) 2026-02-16 14:43:27 +08:00
Giovanni
dfdd062f14
Rewrite of zImage bin parser & new structured data methods (#5893) 2026-02-09 19:00:42 +08:00
Anton Kochkov
6cacb99e98 hppa: use capstone disassembler 2026-02-01 18:23:12 +08:00
Giovanni
d7b2f85c89
Remove RzIO brainfuck/rzweb/rzpipe & RzDebug brainfuck (#5810) 2026-01-17 22:55:47 +08:00
Zapper9982
6918e510bd
Add GNS1 binary format loader for C4000 baseband firmware (#5628) 2026-01-15 08:48:45 +00:00
bubblepipe
0321748674
librz/arch: add analysis plugin for MCS96 (#5622) 2025-12-16 00:09:37 +08:00
billow
68da5f7db2
Add Renesas H8/500 plugin (#5340)
* add h8/500 plugin stub

* refactor h8500 instruction parsing and disassembly logic

* fix: remove debug print statement from h8500 EA parsing
fix: correct plugin name from h8300 to h8500
add: new test case for h8500 disassembly

* refactor: improve operand parsing and disassembly logic for h8500

* refactor: update operand representation in h8500 EA parsing

* refactor: enhance operand definitions and add test cases for h8500 instructions

* fix: add h8500 disassembly plugin to command lists

* refactor: enhance H8500 instruction and operand structures for better parsing

* refactor: update H8500 instruction set with size suffixes and enhance operand handling

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: update H8500 operand handling and address mode definitions for consistency

* refactor: update H8500 addressing flags and operand handling for consistency

* refactor: update H8500 immediate operand syntax to use '#' prefix for consistency

* refactor: update H8500 addressing modes and mnemonics for consistency

* refactor: add new H8500 instructions BNOT, BSET, BSR, and BTST with operand handling

* refactor: update H8500 opcode definitions and add new CLR and CMP instructions

* refactor: add DADD instruction to H8500 opcode definitions and update related tests

* fix: correct memory copy size in h8500_instruction_parse function

* refactor: add DIVXU, EXTS, and EXTU instructions to H8500 opcode definitions and update tests

* refactor: add JMP instruction to H8500 opcode definitions and update tests

* refactor: add JSR instruction to H8500 opcode definitions and update tests

* refactor: add LDC, LDM, and LINK instructions to H8500 opcode definitions and update tests

* Update librz/arch/isa/h8500/h8500.c

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: update H8500 addressing mode and operand flags to use ut64 type

* refactor: update H8500 addressing modes and add MOV instruction test cases

* feat: add MOVFPE, MOVTPE, and MULXU instructions to H8500 opcode and assembly

* feat: add NEG, NOT, and NOP instructions to H8500 opcode and assembly

* feat: enhance H8500 opcode with new instructions and EA flags

* fix: change enum to typedef enum for addressing mode definition

* pjmp

* pjsr | prts

* rot*

* rt*

* scb

* sh*

* sleep | stc | stm

* sub*

* swap

* tas | trapa | trap/vs | tst

* fin disas

* fix header

* add h8500_reg_name function to retrieve register names

* implement H8500 instruction analysis and operand value extraction

* refactor H8500 addressing modes and operand definitions for clarity

* fix msvc 2017 build

* fmt

* fix: update description for H8500 disassembler plugin

* fix: cmd test

* fix: coff h8500 support

* add author and cpus

* fix: test cmd

* feat: add instruction operand string retrieval and new instruction test

* fix: change operand length type from size_t to int in h8500 instruction parsing functions

* feat: add dsub instruction and update operand syntax in h8500 assembly files

* feat: update h8500 opcode descriptions and add new branch instructions

* Fix coff permissions when rz_coff_perms_from_section_flags returns 0

* Fix missing op->size

* refactor: update addressing mode macros and improve operand handling in h8500

* Refactor assembly syntax for H8500 instructions

- Added spaces for better readability in the assembly instruction definitions.
- Updated the formatting of operand lists to include spaces around commas.
- Ensured consistency in the formatting of immediate values and register references.
- Adjusted the assembly test cases to reflect the new formatting style.

* fix: correct permissions for .drectve sections in COFF format

* feat: add initial test cases for h8500 registers and analysis

* fix: add comment to clarify H8300 machine definition in COFF specs

* fix: correct typo in expected output for h8500 analysis

* fix: update data type and constants for H8500 pattern checks

* fix: apply suggestion

* fix: update H8500 instruction encoding and address modes

* fix: add cmp.b and cmp.w instructions for H8500

* fix: refactor H8500 analysis for improved address mode handling

* fix: enhance H8500 analysis for improved operand handling and stack operations

* fix: improve operand handling in H8500 analysis for better instruction processing

* fix: update PJSR instruction format for H8500 and enhance CMP instruction handling

* fix: enhance H8500 function analysis with additional metadata for varfunc and leaffunc

* fix: add documentation and clarify PC-relative mode handling in H8500 instruction parsing

* fix: correct PJMP instruction format to include address dereferencing

* Update librz/arch/isa/h8500/h8500.c

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2025-10-03 13:10:55 +00:00
Rot127
a735e16464 Remove GNU Sparc asm module. 2025-08-25 23:05:58 +08:00
billow
e72cec47ea
librz/arch: add RZIL support for H8/300 and H8/300H (#5119)
* Refactor H8/300 disassembly plugin
* Add support for H8/300H architecture
* Extract ESIL uplifting for H8/300
* Implement RzIL uplifting for H8/300 and H8/300H
* Add `rz_bits_sign_ext{8,16,32,64}`
2025-08-04 12:40:43 +08:00
NOT XVilka
59a375f7f8
Remove incomplete RISC-V ESIL uplifting (#5273)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-07-18 02:26:00 +08:00
Giovanni
a8bd1dd9f6
Rewrite of RzBin AVR plugin to detect known the vectors and handlers. (#5228) 2025-06-28 19:09:12 +08:00
Rot127
1f6c6147ec Add the Qualcomm Peripheral Image loader (MDT files, 32bit only).
It loads .mdt firmware layout files, searches for the other parts in the same directory and loads them.
It resolves symbols, sections etc automatically, and maps them according to the layout
to the virtual address space.

- The iH command provides details about each firmware part as well.
- Memory maps and segment names are prefixed with the parts file name to make them distinct.
- If a firmware part is an ELF library it loads, and resolves its functions, segments etc.

Due to the design of the ELF binary plugin (code duplication with macros for 32/64bit versions),
this only supports 32bit firmware images for now.
This can relatively easily be fixed, by duplicating this plugin but including the 64bit ELF headers.
This requires more tests though.
2025-06-11 15:41:03 +00:00
Premade
b93153b9f4
librz/bin: improve plugin descriptions (#5199)
* Make bin plugins descriptions uniform
* Refactor: swap desc column with author
2025-06-11 22:41:28 +08:00
Giovanni
181c74f4f2
librz/hash: add descriptions to all crypto & hash plugins (#5194) 2025-06-10 23:21:45 +08:00
Premade
bed6ed17ae
Improve rz-bin -L output (#5190)
* Refactor: improve `rz-bin -L` output

Added `author` + `license` cols
Removed `bin/xtr` col

* Refactor: move `license` column + change table output

moved license column before description
table output for bin/xtr now contains `author` + `license` cols

* Add: author field for `librz/bin/p/*`

author selected on oldest SPDX owner
if same time-period then author is chosen based on git history
2025-06-10 12:05:44 +08:00
Seva D.
915d03e307
Add calculation of total information content and information temperature (#5167) 2025-05-30 00:30:24 +08:00
NOT XVilka
ba8c170852
Migrate from Capstone to Zydis (x86 architecture) (#5164)
* Added build files [Capstone to Zydis]

* x86 Analysis [Capstone to Zydis]

* Changed x86 RzIL [Capstone to Zydis]

* Changed asm and arch files [Capstone to Zydis]

* Compilation, build error and test fixes [Capstone to Zydis]

* Test changes [Capstone to Zydis]

* Remaining changes [Capstone to Zydis]

* Added BE support [Capstone to Zydis]

---------

Co-authored-by: tushar3q34 <tushar3q34@gmail.com>
2025-05-23 13:03:46 +00:00
Giovanni
dbe651db33
Normalize the output of L subcommands (#5077) 2025-04-08 16:46:27 +08:00
Rot127
a17da6c712
Fix: Emitted the license instead of the author. (#5073) 2025-04-06 04:14:14 +08:00
NOT XVilka
30ae60a759
Remove RAP protocol (#5046)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-03-27 00:55:06 +08:00
NOT XVilka
e282e551f3
librz/asm: improve plugin descriptions (#5012)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-03-19 03:14:03 +08:00
Giovanni
cd4cd62084
Add RzIL implementation of MIPS32 ops (#4882)
Implements most of the normal MIPS32 isa from MD00086 Rev 5.04
Breakpoints, syscalls, interrupts, TLB, cache, prefetch and traps are NOP

Does not implement MIPS64, FP, COP2 and HW operations.
2025-02-18 18:07:28 +08:00
Giovanni
b019d9d4ca
Add initial support to loongarch 32/64 (#4810) 2025-01-01 15:36:23 +08:00
Giovanni
f623f70c01
Remove mips.gnu (#4802) 2024-12-28 17:29:34 +08:00
well-mannered-goat
d771043899
cmd: filtering La commands output (#4786) 2024-12-26 23:45:40 +08:00
billow
42302da16d
librz/arch: add Xtensa RzIL support (#4712)
- **Add support for rzIL**: Implement various Xtensa instructions and functionalities.
- **Instruction Set Additions**:
  - **Arithmetic and Logical Operations**: sub*, add*, and*, or*, xor*, mul*, div*, rem*, neg*, abs, addi*, addmi, addexp*, addexpm*, addx2|4|8
  - **Bitwise Operations**: srl*, sra*, sll*, andb, andbc, nsau, nsa
  - **Branching and Jumps**: b*, beq*, bne*, ball, bany, bnall, bnone, j, jx, loop*, loopgez, loopnez
  - **Data Transfer**: st*, ld*, l32*, l16*, l8ui, ssi*, ssa*, src
  - **Floating Point**: sqrt0.s, float.s, floor.s, trunc*, ueq*, ule*, ult*, ufloat*, neg.s, oeq.s, ole.s, olt.s, min, max, clamps, nex
  - **System Calls and Synchronization**: syscall, simcall, entry, isync, dsync, esync, rsync, memw
  - **Miscellaneous**: const_s, extui, extw, excw, sext, witlb, wur, rur.*, mksadj.ss, mkdadj.s, const_s
- **Testing and Patches**:
  - Implement asm tests for all
- **Miscellaneous Improvements**:
  - Update Capstone and fix ARM architecture support for building.
2024-12-26 01:55:38 +08:00
Anton Kochkov
a8da505c5f
DEC Alpha disassembly and analysis plugins (#4059) 2024-11-24 21:17:29 +08:00
billow
c3c494d961
librz/arch: migrate Xtensa to Capstone (#4654)
* Add xtensa arch capstone plugin
* Remove xtensa-gnu
* fix: `asm.cpu` is not set correctly, when there is no “,” in asm plugin -> cpus
* fix core_disassembly when n_bytes==0
* fix xtensa_analyze_op_esil
* fix xtensa esil pc mod
* fix xtensa esil l32r
* fix xtensa esil call0
* fix xtensa esil extui
* fix xtensa esil store
* fix xtensa stack inc and ret
* keep `asm.cpu` when valid in cb_asmarch
* fix cb_asmarch
* fix max op size
* xtensa: add cpu select
* xtensa: mark PUSH POP
* xtensa: set src dst
* xtensa: set dir
* xtensa: fix stackframe
2024-11-11 00:38:54 +08:00
Rot127
30953d3bf6
refactor: Use HtSP for storing plugins. (#4687)
* Refactor: Use HtSP for storing plugins.

This saves iterations when searching for a plugin of a given name.
It also allows to save plugin configurations and data in hash table,
all addressed by their name. Hence, usage is more streamlined.

* Fix: iterators iterate over pointers of pointers.

* Soften the NULL check.

If arch is passed on from another struct, NULL is an allowed invalid value.

* Fix some leaks

* Fix NULL checks and incorrect inits

* Fix more leaks

* Add warning if plugin with same name was added before and is overwritten.

* Document rz_str_cmp

* Add function to create new list from iterator.

* Sort plugins alphabetically when listed.

* Fix parameter attributes, NULL checks, leaks and single rename.
2024-10-26 16:31:13 +08:00
مصطفي محمود كمال الدين
3e258f5a08
arch/msp430: implement RzIL uplfiting (#4379)
Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
2024-07-01 19:51:54 +08:00
billow
a02e608075
Fix "pic18 call instructions not detected" (#4532)
* pic18: add test and fix analysis
2024-06-04 12:31:59 +08:00