1
2 #ifndef _ASM_X86_XEN_INTERFACE_64_H
3 #define _ASM_X86_XEN_INTERFACE_64_H
4
5
6
7
8
9
10
11
12 #define FLAT_RING3_CS32 0xe023
13 #define FLAT_RING3_CS64 0xe033
14 #define FLAT_RING3_DS32 0xe02b
15 #define FLAT_RING3_DS64 0x0000
16 #define FLAT_RING3_SS32 0xe02b
17 #define FLAT_RING3_SS64 0xe02b
18
19 #define FLAT_KERNEL_DS64 FLAT_RING3_DS64
20 #define FLAT_KERNEL_DS32 FLAT_RING3_DS32
21 #define FLAT_KERNEL_DS FLAT_KERNEL_DS64
22 #define FLAT_KERNEL_CS64 FLAT_RING3_CS64
23 #define FLAT_KERNEL_CS32 FLAT_RING3_CS32
24 #define FLAT_KERNEL_CS FLAT_KERNEL_CS64
25 #define FLAT_KERNEL_SS64 FLAT_RING3_SS64
26 #define FLAT_KERNEL_SS32 FLAT_RING3_SS32
27 #define FLAT_KERNEL_SS FLAT_KERNEL_SS64
28
29 #define FLAT_USER_DS64 FLAT_RING3_DS64
30 #define FLAT_USER_DS32 FLAT_RING3_DS32
31 #define FLAT_USER_DS FLAT_USER_DS64
32 #define FLAT_USER_CS64 FLAT_RING3_CS64
33 #define FLAT_USER_CS32 FLAT_RING3_CS32
34 #define FLAT_USER_CS FLAT_USER_CS64
35 #define FLAT_USER_SS64 FLAT_RING3_SS64
36 #define FLAT_USER_SS32 FLAT_RING3_SS32
37 #define FLAT_USER_SS FLAT_USER_SS64
38
39 #define __HYPERVISOR_VIRT_START 0xFFFF800000000000
40 #define __HYPERVISOR_VIRT_END 0xFFFF880000000000
41 #define __MACH2PHYS_VIRT_START 0xFFFF800000000000
42 #define __MACH2PHYS_VIRT_END 0xFFFF804000000000
43 #define __MACH2PHYS_SHIFT 3
44
45
46
47
48
49
50 #define SEGBASE_FS 0
51 #define SEGBASE_GS_USER 1
52 #define SEGBASE_GS_KERNEL 2
53 #define SEGBASE_GS_USER_SEL 3
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 #define _VGCF_in_syscall 8
77 #define VGCF_in_syscall (1<<_VGCF_in_syscall)
78 #define VGCF_IN_SYSCALL VGCF_in_syscall
79
80 #ifndef __ASSEMBLY__
81
82 struct iret_context {
83
84 uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss;
85
86 };
87
88 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
89
90 #define __DECL_REG(name) union { \
91 uint64_t r ## name, e ## name; \
92 uint32_t _e ## name; \
93 }
94 #else
95
96 #define __DECL_REG(name) uint64_t r ## name
97 #endif
98
99 struct cpu_user_regs {
100 uint64_t r15;
101 uint64_t r14;
102 uint64_t r13;
103 uint64_t r12;
104 __DECL_REG(bp);
105 __DECL_REG(bx);
106 uint64_t r11;
107 uint64_t r10;
108 uint64_t r9;
109 uint64_t r8;
110 __DECL_REG(ax);
111 __DECL_REG(cx);
112 __DECL_REG(dx);
113 __DECL_REG(si);
114 __DECL_REG(di);
115 uint32_t error_code;
116 uint32_t entry_vector;
117 __DECL_REG(ip);
118 uint16_t cs, _pad0[1];
119 uint8_t saved_upcall_mask;
120 uint8_t _pad1[3];
121 __DECL_REG(flags);
122 __DECL_REG(sp);
123 uint16_t ss, _pad2[3];
124 uint16_t es, _pad3[3];
125 uint16_t ds, _pad4[3];
126 uint16_t fs, _pad5[3];
127 uint16_t gs, _pad6[3];
128 };
129 DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
130
131 #undef __DECL_REG
132
133 #define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12)
134 #define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12)
135
136 struct arch_vcpu_info {
137 unsigned long cr2;
138 unsigned long pad;
139 };
140
141 typedef unsigned long xen_callback_t;
142
143 #define XEN_CALLBACK(__cs, __rip) \
144 ((unsigned long)(__rip))
145
146 #endif
147
148
149 #endif