[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Dom0 builder must run on a valid GDT at all times.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1224772467 -3600 # Node ID 164985e3a46e66685e25413b5915e907318498bc # Parent 6d45bf101d57db9ee45871e2989fdf4f7f961849 x86: Dom0 builder must run on a valid GDT at all times. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/domain_build.c | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff -r 6d45bf101d57 -r 164985e3a46e xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Thu Oct 23 15:23:15 2008 +0100 +++ b/xen/arch/x86/domain_build.c Thu Oct 23 15:34:27 2008 +0100 @@ -194,6 +194,32 @@ static void __init process_dom0_ioports_ } } +/* We run on dom0's page tables for the final part of the build process. */ +static void dom0_pt_enter(struct vcpu *v) +{ + struct desc_ptr gdt_desc = { + .limit = LAST_RESERVED_GDT_BYTE, + .base = (unsigned long)(this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY) + }; + + asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); + local_irq_disable(); + write_ptbase(v); +} + +/* Return to idle domain's page tables. */ +static void dom0_pt_exit(void) +{ + struct desc_ptr gdt_desc = { + .limit = LAST_RESERVED_GDT_BYTE, + .base = GDT_VIRT_START(current) + }; + + write_ptbase(current); + local_irq_enable(); + asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); +} + int __init construct_dom0( struct domain *d, unsigned long _image_start, unsigned long image_len, @@ -700,14 +726,12 @@ int __init construct_dom0( (void)alloc_vcpu(d, i, i % num_online_cpus()); /* Set up CR3 value for write_ptbase */ - if ( paging_mode_enabled(v->domain) ) + if ( paging_mode_enabled(d) ) paging_update_paging_modes(v); else update_cr3(v); - /* Install the new page tables. */ - local_irq_disable(); - write_ptbase(v); + dom0_pt_enter(v); /* Copy the OS image and free temporary buffer. */ elf.dest = (void*)vkern_start; @@ -804,9 +828,7 @@ int __init construct_dom0( xlat_start_info(si, XLAT_start_info_console_dom0); #endif - /* Reinstate the caller's page tables. */ - write_ptbase(current); - local_irq_enable(); + dom0_pt_exit(); #if defined(__i386__) /* Destroy low mappings - they were only for our convenience. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |