riscv 汇编与反汇编
为了riscv指令集,我们需要汇编与反汇编工具来分析指令格式。
可以用下面的两个工具来汇编和反汇编,下载链接:https://pan.baidu.com/s/1eUbBlVc
riscv-none-embed-as.exe -c mm.s -o mm.o --march=rv32g
mm.s
addi x10, x6, 20 addi x11, x6, 20 addi x10, x6, 20 addi x10, x6, 20 beq x10,x11,label addi x12, x6, 20 addi x12, x6, 20 label: addi x12, x6, 20 addi x12, x6, 20 addi x12, x6, 20
riscv-none-embed-objdump.exe -d mm.o -M no-aliases,numeric
反汇编后的代码为:
mm.o: file format elf32-littleriscv Disassembly of section .text: 00000000 <label-0x1c>: 0: 01430513 addi x10,x6,20 4: 01430593 addi x11,x6,20 8: 01430513 addi x10,x6,20 c: 01430513 addi x10,x6,20 10: 00b50663 beq x10,x11,1c <label> 14: 01430613 addi x12,x6,20 18: 01430613 addi x12,x6,20 0000001c <label>: 1c: 01430613 addi x12,x6,20 20: 01430613 addi x12,x6,20 24: 01430613 addi x12,x6,20