Re: x86_64 system call entry points

From: Chuck Ebbert
Date: Tue Jun 06 2006 - 00:17:10 EST


In-Reply-To: <44846210.4080602@xxxxxxxxxxxx>

On Mon, 05 Jun 2006 12:55:44 -0400, Martin Bisson wrote:

> - 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_t getpid32()
> {
> 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"
> "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.

--
Chuck

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/