From 5afef2d800d0914aef4f88517e7b88c1b083093d Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 7 Mar 2006 14:40:23 +0100 Subject: Tighten up the assertion conditions in the GUEST_MODE() macro. Signed-off-by: Keir Fraser --- xen/include/asm-x86/regs.h | 10 ++++++---- 1 file 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); \ }) -- cgit v1.2.3