我有一个在 Linux 用户区运行的非常基本的汇编程序:
section .text
global _start
_start:
mov edx, 14
mov ecx, msg
mov ebx, 1
mov eax, 4
syscall
mov eax, 1
syscall
section .data
msg db "Hello, World!", 0xA
但是,这并不能正常工作,但前提是我将 syscall
替换为 int 0x80
。这些不是做同样的事情吗?我知道 syscall
旨在降低延迟,但除此之外,我认为没有区别。为什么它不起作用?
最佳答案
syscall
仅适用于 x86-64 操作系统,您应该将系统调用号放入 rax
寄存器而不是 eax
。
See this website for more information.
关于linux - 为什么 'syscall' 指令在 Linux 下不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34536006/