Crates.io | MIPS_disassembly |
lib.rs | MIPS_disassembly |
version | |
source | src |
created_at | 2024-08-28 13:51:18.38069 |
updated_at | 2024-10-04 08:25:33.892365 |
description | Takes MIPS machine code and return MIPS assembly. |
homepage | |
repository | |
max_upload_size | |
id | 1354679 |
Cargo.toml error: | TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This crate dissembles u32 into mips assembly
Simple example
use MIPS_disassembly::get_disassembly;
let instr: u32 = 0x24a50001;
let instr_asm: String = get_disassembly(instr);
assert_eq!(instr_asm, "ADDIU $a1, $a1, 1".to_string())
Example using the advance version
use MIPS_disassembly::get_disassembly_adv
let mut sym_tab: HashMap<u32, String> = HashMap::new();
sym_tab.insert(0x00000108, "decode_if".into());
let instr: u32 = 0x11a0001a;
let instr_adrs: u32 = 0x9c;
assert_eq!(
"BEQ $t5, $zero, 26 <decode_if>",
get_disassembly_adv(
instr,
instr_adrs,
&sym_tab,
&MipsDisassemblyOptions::new(true, true)
)
);
Example of the pseudo instruction option
use MIPS_disassembly::get_disassembly_adv;
use MIPS_disassembly::MipsDisassemblyOptions;
use std::collections::HashMap;
let instr: u32 = 0x0;
assert_eq!(
"NOP",
get_disassembly_adv(
instr,
0x0,
&HashMap::new(),
&MipsDisassemblyOptions::new(true, true)
)
);
assert_eq!(
"SLL $zero, $zero, $zero",
get_disassembly_adv(
instr,
0x0,
&HashMap::new(),
&MipsDisassemblyOptions::new(true, false)
)
);