I am getting the following error on my last line of code:
line 14: Runtime exception at 0x00400020: fetch address not aligned on word boundary 0x1000066a
I do not understand why I am getting this error since the word should be aligned perfectly at the address 0x10000004
(Since the global pointer is set to 0x10008000
) so $s1
should be set to the value 0x0001
.
.data 0x10000000
a: .word 5
one: .word 1
.text 0x400000
main: addi $s2, $zero, 30
addi $s3, $zero, 75
addi $sp, $sp, -4
addi $t0, $zero, 7
sw $t0, 0($sp)
lw $s0, -0x8000($gp)
add $s4, $s0, $s2
add $s4, $s4, $s3
lw $s1, -0x7996($gp)
All help and input is greatly appreciated.
0x8000 is not eight thousand, from which you would subtract 4 to get 7996 this is actually in hexadecimal "0x" so the numbers are as such:
0x7FF8 0x7FFC 0x8000 0x8004 0x8008 0x800C etc..
I am also assuming from what you have said that you are on mips-32