Re: question on memory map of process on i386
From: Keith Owens
Date: Wed Aug 03 2005 - 23:24:16 EST
On Wed, 03 Aug 2005 17:28:38 -0600,
"Christopher Friesen" <cfriesen@xxxxxxxxxx> wrote:
>
>On i386, /proc/<pid>/maps shows the following entry:
>
>ffffe000-fffff000 ---p 00000000 00:00 0
>
>This page of memory is way up above TASK_SIZE (which is 0xc0000000), so
>how is it visible to userspace?
>
>Just to complicate things, I seem to find the vma for this page using
>find_vma_prev().
>
>Can anyone explain what's going on?
The gate page is a section of code that is generated as part of the
kernel build. At run time, the gate page is mapped into all the user
space processes. There is also a virtual dynamic .so (vdso) file that
is created by the kernel and picked up by the linker, the vdso maps the
kernel entries in the gate page. Run this command and look for "gate".
ldd -v `which cat`
Once all the dots are joined by the linker, a program can use the vdso
to directly access the gate page, even though the vdso and the
underlying page belongs to the kernel. This direct access does not
incur any of the overhead associated with a syscall, so it can be very
fast.
What is in the gate page varies from one architecture to another, glibc
hides the arch differences from the program. Some sample uses for the
gate page -
i386: select between int 0x80 or sysenter to enter the kernel.
ia64: select between break 0x100000 or epc to enter the kernel, epc is
significantly faster. On ia64, the gate page also contains the
signal delivery trampoline.
-
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/