【问题标题】:Is there a way to make MARS or RARS disassemble an instruction given in hex?有没有办法让 MARS 或 RARS 反汇编以十六进制给出的指令?
【发布时间】:2023-01-09 01:41:20
【问题描述】:

MARS & RARS 包含反汇编程序,但是

  1. 不允许.word.text
  2. 只会反汇编.text部分

    有没有办法让这些模拟器从十六进制中反汇编指令?

    (常见的在线反汇编器也不支持 RISC V!)

【问题讨论】:

    标签: mips disassembly riscv mars-simulator rars-simulator


    【解决方案1】:

    以下代码序列将使 RARS/MARS 从十六进制反汇编(此处为 RARS 版本)。该程序可以编辑为使用其他指令作为十六进制,运行程序后,在“文本段”栏“基本”中可以看到反汇编。必须在“设置”菜单中启用“自修改代码”选项。

        .data
    WStart: 
        .word 0x00052283     # as many instructions in hex or other here as will fit in the nop's below
        .word 0xfae7d2e3
    WEnd:
        .text
    main:
        j next
    CC0:                # after running the program,
        nop             # find disassembly here in the "Basic" column of the "Text Segment" window
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
    next:
        la a0, WStart
        la a1, WEnd
        la a2, CC0
    loop1:
        lw t0, (a0)
        sw t0, (a2)
        addi a0, a0, 4
        addi a2, a2, 4
        bne a0, a1, loop1
        
        li a7, 10
        ecall
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-29
      • 2018-01-19
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-22
      相关资源
      最近更新 更多