How it works
Basilisk is a workspace of focused Rust crates. Dependencies point one way: format parsers know nothing about programs, the SLEIGH crates know nothing about programs, and nothing below the interface depends on it. It ships as a single binary.
The headless data flow
Section titled “The headless data flow”- Import picks a loader and a language through Ghidra’s
.opinionfiles, maps sections into program memory, applies relocations and creates symbols and entry points. - Language loads the compiled SLEIGH (
.sla) for the processor, compiling the.slaspecwhen needed, then decodes instructions and lifts them to p-code on demand. This step exists today. - Analysis schedules analyzers by priority over the addresses that changed: disassembly follows flow, and functions and references are created.
- Decompile runs per function, in parallel; the result is C text plus tokens tied back to addresses.
- Store: everything above writes to the program database through transactions.
The crate map
Section titled “The crate map”Crates with a solid green border exist today; dashed ones are planned; the decompiler’s crates, marked in ember, are being written now (four of them exist). Dependencies point down only.
SLEIGH
Section titled “SLEIGH”SLEIGH is Ghidra’s language for describing instruction sets: how bytes decode into instructions, how they print, and what each one does as p-code. Basilisk reads Ghidra’s SLEIGH specifications unchanged. Both the compiler and the runtime exist today and equal Ghidra’s for all 150 specifications. More: SLEIGH.
P-code
Section titled “P-code”P-code is a small, processor-independent set of operations — copy, load, store, arithmetic, branches, calls — over varnodes (an address space, an offset and a size). Every instruction lifts to a short p-code sequence, and everything after the language layer, the emulator and the decompiler included, works on p-code alone. More: P-code.
The decompiler pipeline
Section titled “The decompiler pipeline”See The decompiler: p-code is built into a control-flow graph, put into SSA form, simplified by rules, given types and variables, and structured into C. It is being ported now (milestone M3).
The program database
Section titled “The program database”Everything Basilisk learns about a binary — memory, code units, symbols, references, functions, types, comments — lives in a program database written through transactions with undo. Its storage engine is being chosen by experiment (ADR-003); the program model is milestone M4.
How it is checked
Section titled “How it is checked”Each part is run against Ghidra on the same input and the outputs are compared. More: How results are checked.