我有一个简单的程序NASM只调用sys_exit
:NASM编程 - `int0x80`与`INT 0x80`
segment .text
global _start
_start:
mov eax, 1 ; 1 is the system identifier for sys_exit
mov ebx, 0 ; exit code
int 0x80 ; interrupt to invoke the system call
当我第一次写的,我犯了一个错误,忘记int
和0x80
之间的空间:
int0x80
...但程序仍编译没有问题!
[prompt]> nasm -f elf MyProgram.asm
[prompt]> ld -o MyProgram MyProgram.o
它只是给我一个分割错误,当我跑它!
[prompt]> ./MyProgram
Segmentation fault
那么这个程序 - 我写的原始程序是什么,缺少空间 - 呢?在NASM中int0x80
(没有空格)是什么意思?
segment .text
global _start
_start:
mov eax, 1
mov ebx, 0
int0x80 ; no space...
发生,如果'INT 0x80的什么'之后被调用? – 2011-03-25 02:08:37
@pst - 好主意! *尝试它*似乎正常执行!即使我添加了一个“sys_write”系统调用以使其成为“Hello World”程序......就像'int0x80'甚至不存在:O – 2011-03-25 02:13:42
您的意思是分割错误消失了吗? – BoltClock 2011-03-25 02:17:33