我希望从系统调用(SYSREAD = 3)读取STDIN(fd = 0),将结果放入名为“my_buffer当中”的数组中:
.section .bss
.lcomm my_buffer,500
.globl _start
_start:
movl $mybuffer,%ecx
movl 500,%edx
movl $0,%ebx
movl $3,%eax
int $0x80
movl $1,%eax
int $0x80
会崩溃。我使用gdb来调试这个核心转储,如下所示:
Core was generated by `h'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000600078 in _start ()
这真的很奇怪,为什么它会在_start()入口处崩溃?