0

我正在上我的第一堂汇编编程课,我的导师希望我们了解基于寻址模式的工作原理。所以这是我写的一些代码来尝试这样做。唯一的问题是我不能理解它,因为我不断遇到分段错误。我评论了这些台词,试图展示我认为他们在做什么。有人可以纠正我的误解。

谢谢!

.text
.global _start
L0: .int 0x99999999
L1: .int 0x12345678
L2: .int 0x11111111
_start:
movl $L1, %eax   #Stores the address of what L1 "pionts to" in regester eax
movb $0, 2(%eax)  #Stores 0 in the location eax has in it +2 memory locations
              #So 0 should be stored in the same place as L1+2
checkHere:


movl $1,%eax
movl $0,%ebx
int $0x80
4

1 回答 1

1

.text是只读的。将您的数据放入.data其中,它应该可以工作。

于 2013-02-23T21:16:18.033 回答