ia64/xen-unstable

changeset 9181:51c59d5d76b0

Tighten up the assertion conditions in the GUEST_MODE() macro.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Mar 07 14:40:23 2006 +0100 (2006-03-07)
parents 583d01868d17
children b41ad96f1242
files xen/include/asm-x86/regs.h
line diff
     1.1 --- a/xen/include/asm-x86/regs.h	Mon Mar 06 23:50:30 2006 +0100
     1.2 +++ b/xen/include/asm-x86/regs.h	Tue Mar 07 14:40:23 2006 +0100
     1.3 @@ -36,10 +36,12 @@ enum EFLAGS {
     1.4      unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
     1.5      /* Frame pointer must point into current CPU stack. */                    \
     1.6      ASSERT(diff < STACK_SIZE);                                                \
     1.7 -    /* If a guest frame, it must not be a ring 0 frame (unless HVM guest). */ \
     1.8 -    ASSERT((diff != 0) || VM86_MODE(r) || !RING_0(r) || HVM_DOMAIN(current)); \
     1.9 -    /* If not a guest frame, it must be a ring 0 frame. */                    \
    1.10 -    ASSERT((diff == 0) || (!VM86_MODE(r) && RING_0(r)));                      \
    1.11 +    /* If a guest frame, it must be have guest privs (unless HVM guest).   */ \
    1.12 +    /* We permit CS==0 which can come from an uninitialised trap entry. */    \
    1.13 +    ASSERT((diff != 0) || VM86_MODE(r) || ((r->cs&3) >= GUEST_KERNEL_RPL) ||  \
    1.14 +           (r->cs == 0) || HVM_DOMAIN(current));                              \
    1.15 +    /* If not a guest frame, it must be a hypervisor frame. */                \
    1.16 +    ASSERT((diff == 0) || (!VM86_MODE(r) && (r->cs == __HYPERVISOR_CS)));     \
    1.17      /* Return TRUE if it's a guest frame. */                                  \
    1.18      (diff == 0);                                                              \
    1.19  })