Browse Source
cranelift: Add RISC-V disassembly capabilities to clif-util (#5117)
This just correctly maps our RISC-V ISA to capstone.
pull/5121/head
Afonso Bordado
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
0 deletions
-
cranelift/src/disasm.rs
|
|
@ -118,6 +118,18 @@ cfg_if! { |
|
|
|
.mode(arch::sysz::ArchMode::Default) |
|
|
|
.build() |
|
|
|
.map_err(map_caperr)?, |
|
|
|
Architecture::Riscv64 {..} => { |
|
|
|
let mut cs = Capstone::new() |
|
|
|
.riscv() |
|
|
|
.mode(arch::riscv::ArchMode::RiscV64) |
|
|
|
.build() |
|
|
|
.map_err(map_caperr)?; |
|
|
|
// Similar to AArch64, RISC-V uses inline constants rather than a separate
|
|
|
|
// constant pool. We want to skip dissasembly over inline constants instead
|
|
|
|
// of stopping on invalid bytes.
|
|
|
|
cs.set_skipdata(true).map_err(map_caperr)?; |
|
|
|
cs |
|
|
|
} |
|
|
|
_ => anyhow::bail!("Unknown ISA"), |
|
|
|
}; |
|
|
|
|
|
|
|