[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [patch] shadow mode cleanup
Hi, Just a minor cleanup in the shadow mode setup code.PAE shadow mode now actually dies in a "not-implemented-yet" BUG() instead of trapping into a null pointer dereference before that ;) please apply, Gerd diff -r 7c951e3eb5ab xen/arch/x86/shadow.c --- a/xen/arch/x86/shadow.c Wed Oct 19 10:53:00 2005 +++ b/xen/arch/x86/shadow.c Fri Oct 21 16:06:59 2005 @@ -3259,7 +3259,7 @@ #elif CONFIG_PAGING_LEVELS == 3 struct shadow_ops MODE_B_HANDLER = { - .guest_paging_levels = 3, + .guest_paging_levels = 3, .invlpg = shadow_invlpg_32, .fault = shadow_fault_32, .update_pagetables = shadow_update_pagetables, @@ -3270,7 +3270,6 @@ .is_out_of_sync = is_out_of_sync, .gva_to_gpa = gva_to_gpa_pae, }; - #endif diff -r 7c951e3eb5ab xen/arch/x86/shadow_public.c --- a/xen/arch/x86/shadow_public.c Wed Oct 19 10:53:00 2005 +++ b/xen/arch/x86/shadow_public.c Fri Oct 21 16:06:59 2005 @@ -32,14 +32,19 @@ #if CONFIG_PAGING_LEVELS >= 3 #include <asm/shadow_64.h> - +#endif + +#if CONFIG_PAGING_LEVELS == 2 +extern struct shadow_ops MODE_A_HANDLER; +#endif +#if CONFIG_PAGING_LEVELS == 3 +extern struct shadow_ops MODE_B_HANDLER; #endif #if CONFIG_PAGING_LEVELS == 4 extern struct shadow_ops MODE_F_HANDLER; extern struct shadow_ops MODE_D_HANDLER; #endif -extern struct shadow_ops MODE_A_HANDLER; #define SHADOW_MAX_GUEST32(_encoded) ((L1_PAGETABLE_ENTRIES_32 - 1) - ((_encoded) >> 16)) /****************************************************************************/ @@ -49,31 +54,42 @@ int shadow_set_guest_paging_levels(struct domain *d, int levels) { + int result = 0; shadow_lock(d); switch(levels) { + case 4: #if CONFIG_PAGING_LEVELS >= 4 - case 4: - if ( d->arch.ops != &MODE_F_HANDLER ) + if ( d->arch.ops != &MODE_F_HANDLER ) { d->arch.ops = &MODE_F_HANDLER; - shadow_unlock(d); - return 1; -#endif + result = 1; + } +#endif + break; case 3: +#if CONFIG_PAGING_LEVELS == 3 + if ( d->arch.ops != &MODE_B_HANDLER ) { + d->arch.ops = &MODE_B_HANDLER; + result = 1; + } +#endif + break; case 2: #if CONFIG_PAGING_LEVELS == 2 - if ( d->arch.ops != &MODE_A_HANDLER ) + if ( d->arch.ops != &MODE_A_HANDLER ) { d->arch.ops = &MODE_A_HANDLER; + result = 1; + } #elif CONFIG_PAGING_LEVELS == 4 - if ( d->arch.ops != &MODE_D_HANDLER ) + if ( d->arch.ops != &MODE_D_HANDLER ) { d->arch.ops = &MODE_D_HANDLER; -#endif - shadow_unlock(d); - return 1; - default: - shadow_unlock(d); - return 0; - } + result = 1; + } +#endif + break; + } + shadow_unlock(d); + return result; } void shadow_invlpg(struct vcpu *v, unsigned long va) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |