Hi, I successfully called the exit syscall from assembly but I'm strugling to call the _getpid syscall and use it's return value. Here is the code I'm using
.text
.globl _getpiddirect
_getpiddirect:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl $39, %eax
int $0x80
addl $8, %esp
popl %ebp
ret
and
#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 keeps returning 4056.