【问题标题】:Based addressing mode assembly x86基于寻址模式的汇编 x86
【发布时间】:2013-02-23 21:06:14
【问题描述】:

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

谢谢!

.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

【问题讨论】:

  • syscall 1h 是exit() 顺便说一句,你在_start 中的意图是什么?此外,请注意在 ELF 分页地址空间的开头以下寻址。

标签: assembly x86 addressing-mode


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多