1 release (0 unstable)
| 2.0.0-alpha.1 | Aug 7, 2025 |
|---|
#771 in Data structures
1MB
23K
SLoC
spimdisasm
spimdisasm (whole name is lowercase) is a matching MIPS disassembler API with built-in instruction analysis.
Currently supports the instruction set for MIPS I, II, III and IV.
Mainly focused on supporting binaries from videogame platforms like the Nintendo 64, PlayStation 1, PlayStation 2, and PlayStation Portable.
A matching disassembler generates assembly that can be assembled back into the same original binary it was produced from, performing a clean round-trip.
Features
- Generates assembly that can be assembled back into the original binary. This is known as matching disassembly.
- Fully written in Rust.
- Full
no_stdsupport, but does require the Rustalloccrate.
- Full
- Supports
.text,.data,.rodataand.bssdisassembly. - Generates separated files for each section of a file (
.text,.data,.rodataand.bss). - Supports spliting multiple assembly files from a single input binary.
- Automatic function detection.
- Can detect the limits of when a function starts and end with pretty high success rate.
- Can detect if a function is handwritten too to a certain degree.
- Can identify symbols identification and actually symbolize them for a more flexible generated assembly.
- Reloc pairing (i.e.
%hi/%lorelocs) with high success rate. - Function spliting with rodata migration.
- Supports inference of multiple data types, like floats, doubles, strings, jumptables, bytes and shorts.
- String detection with medium to high success rate.
- Allows to set user-defined symbol metadata, like names, type, sizes, etc.
- Support for big and little endian.
- Autogenerated symbols can be named after the section they come from (
RO_andB_for.rodataand.bsssections) or its type (STR_,FLT_andDBL_for string, floats and doubles respectively). - Simple file boundary detection.
- Detects boundaries on .text and .rodata sections.
- Very customizable: Many features can be toggled on and off.
- MIPS instructions features:
- Named registers for MIPS VR4300's coprocessors.
- Support for many pseudoinstructions.
- Properly handle move to/from coprocessor instructions.
- Support for o32, n32, n64, EABI32 and EABI64 ABI register names.
- Some workarounds for some specific compilers/assemblers:
SN64/PSYQ:div/divufix: tweaks a bit the produceddiv,divuandbreakinstructions.
- Support for specific MIPS instruction set extensions:
- N64's RSP instruction disassembly support.
- RSP decoding has been tested to build back to matching assemblies with armips.
- PS1's R3000 GTE instruction set support.
- PSP's R4000 ALLEGREX instruction set support.
- PS2's R5900 EE instruction set support.
- N64's RSP instruction disassembly support.
- Support for disassembling sections with overlapping addresses.
Minimum Supported Rust Version (MSRV)
The current version of spimdisasm requires Rust 1.83.0 or greater.
The current policy is that this may be bumped in minor spimdisasm updates.
Installation
spimdisasm is available on crates.io and can be included in your Cargo enabled project like this:
[dependencies]
spimdisasm = "2.0.0-alpha.1"
Crate features
There are a few compilation features. Currently none of them are enabled by default.
- Misc:
std: Turns onstd(or turn offno_std, depending on how you prefer it). This currently doesn't do much.- Enables the
stdfeature on dependencies.
- Enables the
hash_tables: Toggles the internal implementation of some unordered maps to useHashMaps instead ofBTreeMaps, allowing for possible (unmeasured) performance improvements.- Enables the
stdfeature.
- Enables the
The other features are meant for internal use only.
Versioning and changelog
This library follows Semantic Versioning. We try to always keep backwards compatibility, so no breaking changes should happen until a major release (i.e. jumping from 1.X.X to 2.0.0).
To see what changed on each release check either the CHANGELOG.md file or check the releases page on Github. You can also use this link to check the latest release.
Dependencies
~6MB
~187K SLoC