【发布时间】:2017-06-18 23:59:15
【问题描述】:
我在 GDB 中注意到,在我调用 __NR_write 操作之后,立即将 __NR_lchown 系统调用号 (16) 传递到 rax 寄存器。我得到的代码是:
.data
BemVindo: .ascii "Seja bem vindo!\n"
Digite: .ascii "Digite alguma coisa\n"
_start:
mov $4, %rax
mov $1, %rbx
mov $BemVindo, %rcx
mov $16, %rdx
int $0x80
mov $4, %rax # had to add this line because I was assuming that value 4 was still there in the register
mov $Digite, %rcx
mov $20, %rdx
int $0x80
据我unistd.h:
#define __NR_write 4
#define __NR_lchown 16
所以,既然我在 linux 上,我认为这个 lchown 一定与命令 chown 有关系,对吧?无论如何,问题是,为什么在我调用操作后立即加载值 16?
【问题讨论】:
标签: assembly system-calls