.section .data
.section .text
.globl _start
_start:
movl $1, %eax # this is the linux kernel command
# number (system call) for exiting
# a program
movl $4, %ebx # this is the status number we will
# return to the operating system.
# Change this around and it will
# return different things to
# echo $?
int $0x80 # this wakes up the kernel to run
# the exit command
但如果删除最后一行代码int 0x80
,则会导致段错误。
我不知道为什么?谁能告诉我。
感谢您的时间。
谢谢大家。现在我得到了答案。
如果没有代码行int $0x80
,系统不知道此应用程序是否已结束或此应用程序何时结束。因此会导致崩溃。
答案 0 :(得分:1)
如果删除int 0x80
,您将遇到分段错误,因为它会在您的程序后立即开始执行RAM中的任何随机字节。你真的无法预测会发生什么,其他事情肯定会发生,但是可能会出现段错误,因为随机数据很可能会成为你进程内存之外的内存访问。