mips - MIPS 错误的 MARS 仿真器:地址超出范围 0x20000000
问题描述
我不确定我在哪里搞砸了,但我正在为 MIPS 使用 MARS 模拟器,并且在我的
lw $s6, 0($s7) #s6 now holds c[i]
线。
这是我的错误:
Error in C:\Programming\mips1.asm line 14: Runtime exception at 0x00400020: address out of range 0x20000000
Go: execution terminated with errors.
.text
.globl main
main:
add $s0, $zero, $zero
lui $s3, 0x2000
addi $s5, $zero, 100
addi $sp, $sp, -8
Loop:
slt $t2, $s0, $s5
beq $zero, $t2, Exit
sll $s7, $s0, 2
add $s7, $s7, $s3 #s7 is now the address of c[i]
lw $s6, 0($s7) #s6 now holds c[i]
slt $t3, $s0, $s1 #set t3 if i is less than a
bne $zero, $t3, Else
sw $s2, 0($s7) #stores b into c[i]
add $s0, $s0, 1
j Loop
Else: add $s2, $zero, $s6
add $s0, $s0, 1
j Loop
Exit: addi $sp, $sp, 8
li $v0, 10
syscall
解决方案
我解决了它,结果我需要一个较低的地址才能使其成为堆的一部分。MARS 堆从 0x10040000 开始并向上移动。
我将 0x2000 更改为 0x1005,它在 MARS 中工作
推荐阅读
- database - Cross-datacenter sync after failure
- elasticsearch - 如何在elasticsearch中上传批量数据?
- android - 使单选按钮图标居中
- javascript - 使用 fs.watch 观察不同目录中的多个文件并遇到一些错误
- dart - Flutter Image 在底部淡出(渐变)
- java - Micronaut property injection does not work with Gradle multi-project build
- java - Sort with one element at the end
- php - Variable in SQL not working with prepare statement
- javascript - 两个自定义元素之间的依赖关系,以及 Polymer 服务的路径
- ruby-on-rails - Trouble when creating new article