WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

[Xen-devel] [patch] shadow mode cleanup

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [patch] shadow mode cleanup
From: Gerd Knorr <kraxel@xxxxxxx>
Date: 2005年10月21日 16:10:47 +0200
Delivery-date: 2005年10月21日 14:08:22 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050715)
 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [patch] shadow mode cleanup, Gerd Knorr <=
Previous by Date: Re: [Xen-devel] Xen 3.0 and Pacifica , Mark Williamson
Next by Date: Re: [Xen-devel] App virtualisation, not OS virtualisation , Mark Williamson
Previous by Thread: [Xen-devel] dom0_shadow=1 , Gerd Knorr
Next by Thread: [Xen-devel] just a question on the Xen administration by the web , Philippe Berthault
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /