1 
2 #ifndef __X86_REGS_H__
3 #define __X86_REGS_H__
4 
5 #include <asm/x86_64/regs.h>
6 
7 #define guest_mode(r)                                                         \
8 ({                                                                            \
9     unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
10     /* Frame pointer must point into current CPU stack. */                    \
11     ASSERT(diff < STACK_SIZE);                                                \
12     /* If not a guest frame, it must be a hypervisor frame. */                \
13     ASSERT((diff == 0) || (r->cs == __HYPERVISOR_CS));                        \
14     /* Return TRUE if it's a guest frame. */                                  \
15     (diff == 0);                                                              \
16 })
17 
18 #define return_reg(v) ((v)->arch.user_regs.rax)
19 
20 #endif /* __X86_REGS_H__ */
21