我已经将我的大脑划到了极限,并且还在网上搜索了有关 Assembly 中文件处理的信息,但我仍然对此感到困惑。我正在使用 linux shell 以 AT&T 语法创建汇编程序。基本上我不明白如何将文件名推送到 ebx。以下是让我感到困惑的代码。
section .text
global _start
_start:
pop ebx ; argc (argument count)
pop ebx ; argv[0] (argument 0, the program name)
pop ebx ; The first real arg, a filename
mov eax,8 ; The syscall number for creat() (we already have the filename in ebx)
mov ecx,00644Q ; Read/write permissions in octal (rw_rw_rw_)
int 80h ; Call the kernel
; Now we have a file descriptor in eax
我不明白,将值弹出到 ebx 将如何帮助打开文件?请解释这些行。我猜这些行正在接受输入,就像我们在 C 中所做的那样{eg in main(int argc, char *argv[]) }。但我无法与之关联。