有没有办法让MARS或RARS根据十六进制指令进行反汇编?

huangapple go评论61阅读模式
英文:

Is there a way to make MARS or RARS disassemble an instruction given in hex?

问题

MARS和RARS包含一个反汇编器,但是:

  1. 不允许在.text内使用.word指令
  2. 只会反汇编.text部分

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

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

英文:

MARS & RARS contain a disassembler, but

  1. don't allow .word within .text
  2. will only disassemble the .text section

Is there a way to get these simulators to disassemble an instruction from hex?

(The common online disassemblers also don't support RISC V!)

答案1

得分: 0

以下是翻译好的部分:

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

	.data
WStart:	
	.word 0x00052283     # 尽可能多的十六进制或其他指令可以放在下面的 nop 中
	.word 0xfae7d2e3
WEnd:
	.text
main:
	j next
CC0:	            # 在运行程序后,
    nop             # 在“文本段”窗口的“基本”列中找到反汇编内容
	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

有没有办法让MARS或RARS根据十六进制指令进行反汇编?

英文:

The following code sequence will make RARS/MARS disassemble from hex (RARS version here).  The program can be edited to use other instructions as hex, and, after running the program, disassembly can be seen in the "Text Segment" column "Basic".  The option for "Self-modifying code" must be enabled in the "Settings" menu.

	.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

有没有办法让MARS或RARS根据十六进制指令进行反汇编?

huangapple
  • 本文由 发表于 2023年1月9日 01:25:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75049911.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定