aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-x86/regs.h
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-03-07 14:40:23 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-03-07 14:40:23 +0100
commit5afef2d800d0914aef4f88517e7b88c1b083093d (patch)
tree3bda5157010852170e8c6520bc4a1ee21815569c /xen/include/asm-x86/regs.h
parent90e34b67757f70357c78bc8b536ec0cac03083ce (diff)
downloadxen-5afef2d800d0914aef4f88517e7b88c1b083093d.tar.gz
xen-5afef2d800d0914aef4f88517e7b88c1b083093d.tar.bz2
xen-5afef2d800d0914aef4f88517e7b88c1b083093d.zip
Tighten up the assertion conditions in the GUEST_MODE() macro.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/asm-x86/regs.h')
-rw-r--r--xen/include/asm-x86/regs.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/xen/include/asm-x86/regs.h b/xen/include/asm-x86/regs.h
index 8c88d5394b..55ac21b1d3 100644
--- a/xen/include/asm-x86/regs.h
+++ b/xen/include/asm-x86/regs.h
@@ -36,10 +36,12 @@ enum EFLAGS {
unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r); \
/* Frame pointer must point into current CPU stack. */ \
ASSERT(diff < STACK_SIZE); \
- /* If a guest frame, it must not be a ring 0 frame (unless HVM guest). */ \
- ASSERT((diff != 0) || VM86_MODE(r) || !RING_0(r) || HVM_DOMAIN(current)); \
- /* If not a guest frame, it must be a ring 0 frame. */ \
- ASSERT((diff == 0) || (!VM86_MODE(r) && RING_0(r))); \
+ /* If a guest frame, it must be have guest privs (unless HVM guest). */ \
+ /* We permit CS==0 which can come from an uninitialised trap entry. */ \
+ ASSERT((diff != 0) || VM86_MODE(r) || ((r->cs&3) >= GUEST_KERNEL_RPL) || \
+ (r->cs == 0) || HVM_DOMAIN(current)); \
+ /* If not a guest frame, it must be a hypervisor frame. */ \
+ ASSERT((diff == 0) || (!VM86_MODE(r) && (r->cs == __HYPERVISOR_CS))); \
/* Return TRUE if it's a guest frame. */ \
(diff == 0); \
})