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-02-03 20:30:54 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-02-03 20:30:54 +0100
commita040fb1a942c27881bda6a18fbb5af8781db1593 (patch)
treee3c9a1b7674a38b3b0471d08c283cdcbf64193f3 /xen/include/asm-x86/regs.h
parent2f41331f4c32dbc2d27e261783f472cccc648719 (diff)
downloadxen-a040fb1a942c27881bda6a18fbb5af8781db1593.tar.gz
xen-a040fb1a942c27881bda6a18fbb5af8781db1593.tar.bz2
xen-a040fb1a942c27881bda6a18fbb5af8781db1593.zip
Fix show_registers() on x86/64. Get rid of
GUEST_CONTEXT() macro and the eflags==0 hack to detect an HVM-guest stack frame. Various cleanups and fixes. 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.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/xen/include/asm-x86/regs.h b/xen/include/asm-x86/regs.h
index dfa0868e44..8c88d5394b 100644
--- a/xen/include/asm-x86/regs.h
+++ b/xen/include/asm-x86/regs.h
@@ -31,8 +31,17 @@ enum EFLAGS {
EF_ID = 0x00200000, /* id */
};
-#define GUEST_MODE(_r) (likely(VM86_MODE(_r) || !RING_0(_r)))
-
-#define GUEST_CONTEXT(_ed, _r) ((HVM_DOMAIN(_ed) && ((_r)->eflags == 0)) || GUEST_MODE(_r))
+#define GUEST_MODE(r) \
+({ \
+ 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))); \
+ /* Return TRUE if it's a guest frame. */ \
+ (diff == 0); \
+})
#endif /* __X86_REGS_H__ */