From: Gerd Knorr <kraxel@suse.de>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [patch] shadow mode cleanup
Date: Fri, 21 Oct 2005 16:10:47 +0200 [thread overview]
Message-ID: <4358F6E7.5070302@suse.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
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
[-- Attachment #2: fix --]
[-- Type: text/plain, Size: 2747 bytes --]
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)
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2005-10-21 14:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4358F6E7.5070302@suse.de \
--to=kraxel@suse.de \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.