MIPS的火星模拟器错误:地址超出范围0x20000000
我不确定我在哪里搞砸了,但我正在使用火星模拟器进行MIPS,并且在我的计算机上遇到了一个错误MIPS的火星模拟器错误:地址超出范围0x20000000,mips,Mips,我不确定我在哪里搞砸了,但我正在使用火星模拟器进行MIPS,并且在我的计算机上遇到了一个错误 lw$s6,0($s7)#s6现在持有c[i]行 这是我的错误: Error in C:\Programming\mips1.asm line 14: Runtime exception at 0x00400020: address out of range 0x20000000 Go: execution terminated with errors. 我解决了它,结果发现我需要一个更低的地址,以
lw$s6,0($s7)#s6现在持有c[i]
行
这是我的错误:
Error in C:\Programming\mips1.asm line 14: Runtime exception at 0x00400020: address out of range 0x20000000
Go: execution terminated with errors.
我解决了它,结果发现我需要一个更低的地址,以便它成为堆的一部分。MARS堆从0x10040000开始并向上移动 我将0x2000改为0x1005,它在火星上工作
.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