好。我的任务看起来像这样:%edx
寄存器的值为0xe000
,%ecx
寄存器的值为0x200
。记下从以下计算的地址:
0x10(%edx)
(%edx, %ecx)
(%edx, %ecx, 4)
0x8(,%ecx,2)
我知道在第一个例子中它应该是0x10+0xe000
,在第二个地址它应该是0xe000+0x200
等。但是当我想用汇编程序测试自己时,它不会工作(抛出Segmentation fault (core dumped)
:
.section .rodata
.LC0:
.string "%d"
.text
.globl main
.type main, @function
main:
pushq %rbp
movq %rsp, %rbp
movl $0xe000, -4(%rbp)
movl $0x200, -8(%rbp)
movl -4(%rbp), %edx
movl -8(%rbp), %ecx
movl $.LC0, %edi
movl 0x10(%edx), %esi
movl $0, %eax
call printf
movl $0, %eax
leave
ret
这是例如nr 1.我做错了什么? (Manjaro 64位)