【发布时间】:2010-05-14 12:47:58
【问题描述】:
我成功地从程序集中调用了退出系统调用,但我正在努力调用 _getpid 系统调用并使用它的返回值。这是我正在使用的代码
.text
.globl _getpiddirect
_getpiddirect:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl $39, %eax
int $0x80
addl $8, %esp
popl %ebp
ret
和
#include <stdio.h>
#include <unistd.h>
extern unsigned long getpiddirect();
int main(int argc, const char *argv[])
{
printf("%lu\n", getpiddirect());
printf("%lu\n", (unsigned long) getpid());
return 0;
}
getpiddirect 不断返回 4056。
【问题讨论】:
标签: macos kernel system-calls