x86_64 system call entry points
In-Reply-To: <[email protected]>
Quoted 15 lines · Martin Bisson
- sysenter/32 bits, executed on a 32 bit machine: I get a segfault on the sysenter instruction. I use the following code to enter the system call:
pid_tgetpid32(){ pid_t resultvar; asm volatile ( "push %%ebp\n\t" "push %%ecx\n\t" "push %%edx\n\t" "mov %%esp,%%ebp\n\t" "sysenter\n\t" ".space 20,0x90\n\t" "pop %%edx\n\t"
Quoted 8 lines
"pop %%ecx\n\t"
"pop %%ebp\n\t"
: "=a" (resultvar)
: "0" (__NR_getpid)
: "memory");
return resultvar;
}sysenter always returns to a fixed address (in the vdso) no matter where you invoke it from.
Signature · 1 line
Chuck