nx_dis.nx
buildroot/runtime/nx_dis.nx
about
nx_dis.nx -- RV64I disassembler (machine bytes -> mnemonic).
Inverse of nxasm: takes 4-byte RV64 instructions and prints the
canonical mnemonic + operand list. Foundation for sovereign
`objdump -d` (the disassembly view), the future nx_dbg.nx
stepping debugger, and Wheeler-DDC byte-level audit.
Coverage (v0.0.1 -- the instruction set our codegen actually
emits):
R-type: add, sub, and, or, xor, sll, srl, sra, slt, sltu
mul, mulh, div, divu, rem, remu (M extension)
I-type: addi, andi, ori, xori, slli, srli, srai, slti, sltiu
jalr, ld, lw, lh, lb, lwu, lhu, lbu, ebreak, ecall
S-type: sd, sw, sh, sb
B-type: beq, bne, blt, bge, bltu, bgeu
U-type: lui, auipc
J-type: jal
Floating-point (F/D extension), atomic (A), compressed (C),
vector (V) deferred -- separate commits when nxc2 emits them.
Pseudoinstruction recognition (addi rd,zero,N -> li, etc.) is
also deferred to nx_dis_pretty.nx.
dependencies 1 imports · 3 importers
imports: syscalls.nx
imported by: nx_dbg.nxnx_rv64_sim.nxnx_toolchain.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 37 | func nx_dis_word_at(buf: *u8, off: i64) -> i64 |
| 45 | func nx_dis_opcode(w: i64) -> i64 { return w & 0x7F } |
| 46 | func nx_dis_rd(w: i64) -> i64 { return (w >> 7) & 0x1F } |
| 47 | func nx_dis_funct3(w: i64) -> i64 { return (w >> 12) & 0x7 } |
| 48 | func nx_dis_rs1(w: i64) -> i64 { return (w >> 15) & 0x1F } |
| 49 | func nx_dis_rs2(w: i64) -> i64 { return (w >> 20) & 0x1F } |
| 50 | func nx_dis_funct7(w: i64) -> i64 { return (w >> 25) & 0x7F } |
| 53 | func nx_dis_imm_i(w: i64) -> i64 |
| 60 | func nx_dis_imm_s(w: i64) -> i64 |
| 67 | func nx_dis_imm_b(w: i64) -> i64 |
| 78 | func nx_dis_imm_u(w: i64) -> i64 |
| 85 | func nx_dis_imm_j(w: i64) -> i64 |
| 100 | func nx_dis_reg_name(n: i64) -> *u8 |
| 139 | func nx_dis_r_mnem(funct3: i64, funct7: i64, is_w: i64) -> *u8 called by 1: nx_dis_one |
| 177 | func nx_dis_i_alu_mnem(funct3: i64, funct7: i64, is_w: i64) -> *u8 called by 1: nx_dis_one |
| 201 | func nx_dis_load_mnem(funct3: i64) -> *u8 called by 1: nx_dis_one |
| 213 | func nx_dis_store_mnem(funct3: i64) -> *u8 called by 1: nx_dis_one |
| 222 | func nx_dis_branch_mnem(funct3: i64) -> *u8 called by 1: nx_dis_one |
| 234 | func nx_dis_puts(fd: i64, s: *u8) -> i64 called by 1: nx_dis_one |
| 241 | func nx_dis_putdec(fd: i64, v: i64) -> i64 called by 1: nx_dis_one |
| 271 | func nx_dis_one(buf: *u8, off: i64, fd: i64) -> i64 called by 2: nx_dbg_dump_disasmnx_dis_range calls 20: nx_dis_word_atnx_dis_opcodenx_dis_putsnx_dis_r_mnemnx_dis_funct3nx_dis_funct7+14 |
| 415 | func nx_dis_range(buf: *u8, off: i64, len: i64, fd: i64) -> i64 |
| 428 | func main() -> i64 |