1
linux/arch/x86/xen
Jeremy Fitzhardinge d6182fbf04 xen64: allocate and manage user pagetables
Because the x86_64 architecture does not enforce segment limits, Xen
cannot protect itself with them as it does in 32-bit mode.  Therefore,
to protect itself, it runs the guest kernel in ring 3.  Since it also
runs the guest userspace in ring3, the guest kernel must maintain a
second pagetable for its userspace, which does not map kernel space.
Naturally, the guest kernel pagetables map both kernel and userspace.

The userspace pagetable is attached to the corresponding kernel
pagetable via the pgd's page->private field.  It is allocated and
freed at the same time as the kernel pgd via the
paravirt_pgd_alloc/free hooks.

Fortunately, the user pagetable is almost entirely shared with the
kernel pagetable; the only difference is the pgd page itself.  set_pgd
will populate all entries in the kernel pagetable, and also set the
corresponding user pgd entry if the address is less than
STACK_TOP_MAX.

The user pagetable must be pinned and unpinned with the kernel one,
but because the pagetables are aliased, pgd_walk() only needs to be
called on the kernel pagetable.  The user pgd page is then
pinned/unpinned along with the kernel pgd page.

xen_write_cr3 must write both the kernel and user cr3s.

The init_mm.pgd pagetable never has a user pagetable allocated for it,
because it can never be used while running usermode.

One awkward area is that early in boot the page structures are not
available.  No user pagetable can exist at that point, but it
complicates the logic to avoid looking at the page structure.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-16 11:05:38 +02:00
..
enlighten.c xen64: allocate and manage user pagetables 2008-07-16 11:05:38 +02:00
grant-table.c xen: make grant table arch portable 2008-04-24 23:57:32 +02:00
Kconfig Merge commit 'v2.6.26-rc8' into x86/xen 2008-06-25 12:16:51 +02:00
Makefile xen64: add 64-bit assembler 2008-07-16 10:59:09 +02:00
mmu.c xen64: allocate and manage user pagetables 2008-07-16 11:05:38 +02:00
mmu.h xen64: allocate and manage user pagetables 2008-07-16 11:05:38 +02:00
multicalls.c xen: print backtrace on multicall failure 2008-07-16 10:55:21 +02:00
multicalls.h xen: add mechanism to extend existing multicalls 2008-06-25 15:17:34 +02:00
setup.c xen64: register callbacks in arch-independent way 2008-07-16 11:03:01 +02:00
smp.c xen: set num_processors 2008-07-16 11:01:31 +02:00
suspend.c xen: add xen_arch_resume()/xen_timer_resume hook for ia64 support 2008-07-16 10:55:50 +02:00
time.c x86: rename paravirtualized TSC functions 2008-07-09 07:43:28 +02:00
vdso.h
xen-asm_32.S xen64: add 64-bit assembler 2008-07-16 10:59:09 +02:00
xen-asm_64.S xen64: deal with extra words Xen pushes onto exception frames 2008-07-16 11:02:31 +02:00
xen-head.S xen64: add xen-head code to head_64.S 2008-07-16 10:58:41 +02:00
xen-ops.h xen64: deal with extra words Xen pushes onto exception frames 2008-07-16 11:02:31 +02:00