lkml.org 
[lkml]   [2006]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: x86_64 system call entry points
In-Reply-To: <44846210.4080602@discreet.com>

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-06 06:20    [W:0.289 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site