Re: x86_64 system call entry points

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In-Reply-To: <[email protected]>

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux