0001
0002 #ifndef _ASM_X86_XEN_INTERFACE_64_H
0003 #define _ASM_X86_XEN_INTERFACE_64_H
0004
0005
0006
0007
0008
0009
0010
0011
0012 #define FLAT_RING3_CS32 0xe023
0013 #define FLAT_RING3_CS64 0xe033
0014 #define FLAT_RING3_DS32 0xe02b
0015 #define FLAT_RING3_DS64 0x0000
0016 #define FLAT_RING3_SS32 0xe02b
0017 #define FLAT_RING3_SS64 0xe02b
0018
0019 #define FLAT_KERNEL_DS64 FLAT_RING3_DS64
0020 #define FLAT_KERNEL_DS32 FLAT_RING3_DS32
0021 #define FLAT_KERNEL_DS FLAT_KERNEL_DS64
0022 #define FLAT_KERNEL_CS64 FLAT_RING3_CS64
0023 #define FLAT_KERNEL_CS32 FLAT_RING3_CS32
0024 #define FLAT_KERNEL_CS FLAT_KERNEL_CS64
0025 #define FLAT_KERNEL_SS64 FLAT_RING3_SS64
0026 #define FLAT_KERNEL_SS32 FLAT_RING3_SS32
0027 #define FLAT_KERNEL_SS FLAT_KERNEL_SS64
0028
0029 #define FLAT_USER_DS64 FLAT_RING3_DS64
0030 #define FLAT_USER_DS32 FLAT_RING3_DS32
0031 #define FLAT_USER_DS FLAT_USER_DS64
0032 #define FLAT_USER_CS64 FLAT_RING3_CS64
0033 #define FLAT_USER_CS32 FLAT_RING3_CS32
0034 #define FLAT_USER_CS FLAT_USER_CS64
0035 #define FLAT_USER_SS64 FLAT_RING3_SS64
0036 #define FLAT_USER_SS32 FLAT_RING3_SS32
0037 #define FLAT_USER_SS FLAT_USER_SS64
0038
0039 #define __HYPERVISOR_VIRT_START 0xFFFF800000000000
0040 #define __HYPERVISOR_VIRT_END 0xFFFF880000000000
0041 #define __MACH2PHYS_VIRT_START 0xFFFF800000000000
0042 #define __MACH2PHYS_VIRT_END 0xFFFF804000000000
0043 #define __MACH2PHYS_SHIFT 3
0044
0045
0046
0047
0048
0049
0050 #define SEGBASE_FS 0
0051 #define SEGBASE_GS_USER 1
0052 #define SEGBASE_GS_KERNEL 2
0053 #define SEGBASE_GS_USER_SEL 3
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 #define _VGCF_in_syscall 8
0077 #define VGCF_in_syscall (1<<_VGCF_in_syscall)
0078 #define VGCF_IN_SYSCALL VGCF_in_syscall
0079
0080 #ifndef __ASSEMBLY__
0081
0082 struct iret_context {
0083
0084 uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss;
0085
0086 };
0087
0088 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
0089
0090 #define __DECL_REG(name) union { \
0091 uint64_t r ## name, e ## name; \
0092 uint32_t _e ## name; \
0093 }
0094 #else
0095
0096 #define __DECL_REG(name) uint64_t r ## name
0097 #endif
0098
0099 struct cpu_user_regs {
0100 uint64_t r15;
0101 uint64_t r14;
0102 uint64_t r13;
0103 uint64_t r12;
0104 __DECL_REG(bp);
0105 __DECL_REG(bx);
0106 uint64_t r11;
0107 uint64_t r10;
0108 uint64_t r9;
0109 uint64_t r8;
0110 __DECL_REG(ax);
0111 __DECL_REG(cx);
0112 __DECL_REG(dx);
0113 __DECL_REG(si);
0114 __DECL_REG(di);
0115 uint32_t error_code;
0116 uint32_t entry_vector;
0117 __DECL_REG(ip);
0118 uint16_t cs, _pad0[1];
0119 uint8_t saved_upcall_mask;
0120 uint8_t _pad1[3];
0121 __DECL_REG(flags);
0122 __DECL_REG(sp);
0123 uint16_t ss, _pad2[3];
0124 uint16_t es, _pad3[3];
0125 uint16_t ds, _pad4[3];
0126 uint16_t fs, _pad5[3];
0127 uint16_t gs, _pad6[3];
0128 };
0129 DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
0130
0131 #undef __DECL_REG
0132
0133 #define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12)
0134 #define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12)
0135
0136 struct arch_vcpu_info {
0137 unsigned long cr2;
0138 unsigned long pad;
0139 };
0140
0141 typedef unsigned long xen_callback_t;
0142
0143 #define XEN_CALLBACK(__cs, __rip) \
0144 ((unsigned long)(__rip))
0145
0146 #endif
0147
0148
0149 #endif