| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
#ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_64_H__ |
| 28 |
#define __XEN_PUBLIC_ARCH_X86_XEN_X86_64_H__ |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#if __XEN_INTERFACE_VERSION__ < 0x00030203 |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
#define TRAP_INSTR "syscall" |
| 47 |
#endif |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
#define FLAT_RING3_CS32 0xe023 |
| 57 |
#define FLAT_RING3_CS64 0xe033 |
| 58 |
#define FLAT_RING3_DS32 0xe02b |
| 59 |
#define FLAT_RING3_DS64 0x0000 |
| 60 |
#define FLAT_RING3_SS32 0xe02b |
| 61 |
#define FLAT_RING3_SS64 0xe02b |
| 62 |
|
| 63 |
#define FLAT_KERNEL_DS64 FLAT_RING3_DS64 |
| 64 |
#define FLAT_KERNEL_DS32 FLAT_RING3_DS32 |
| 65 |
#define FLAT_KERNEL_DS FLAT_KERNEL_DS64 |
| 66 |
#define FLAT_KERNEL_CS64 FLAT_RING3_CS64 |
| 67 |
#define FLAT_KERNEL_CS32 FLAT_RING3_CS32 |
| 68 |
#define FLAT_KERNEL_CS FLAT_KERNEL_CS64 |
| 69 |
#define FLAT_KERNEL_SS64 FLAT_RING3_SS64 |
| 70 |
#define FLAT_KERNEL_SS32 FLAT_RING3_SS32 |
| 71 |
#define FLAT_KERNEL_SS FLAT_KERNEL_SS64 |
| 72 |
|
| 73 |
#define FLAT_USER_DS64 FLAT_RING3_DS64 |
| 74 |
#define FLAT_USER_DS32 FLAT_RING3_DS32 |
| 75 |
#define FLAT_USER_DS FLAT_USER_DS64 |
| 76 |
#define FLAT_USER_CS64 FLAT_RING3_CS64 |
| 77 |
#define FLAT_USER_CS32 FLAT_RING3_CS32 |
| 78 |
#define FLAT_USER_CS FLAT_USER_CS64 |
| 79 |
#define FLAT_USER_SS64 FLAT_RING3_SS64 |
| 80 |
#define FLAT_USER_SS32 FLAT_RING3_SS32 |
| 81 |
#define FLAT_USER_SS FLAT_USER_SS64 |
| 82 |
|
| 83 |
#define __HYPERVISOR_VIRT_START 0xFFFF800000000000 |
| 84 |
#define __HYPERVISOR_VIRT_END 0xFFFF880000000000 |
| 85 |
#define __MACH2PHYS_VIRT_START 0xFFFF800000000000 |
| 86 |
#define __MACH2PHYS_VIRT_END 0xFFFF804000000000 |
| 87 |
|
| 88 |
#ifndef HYPERVISOR_VIRT_START |
| 89 |
#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) |
| 90 |
#define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END) |
| 91 |
#endif |
| 92 |
|
| 93 |
#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) |
| 94 |
#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) |
| 95 |
#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3) |
| 96 |
#ifndef machine_to_phys_mapping |
| 97 |
#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) |
| 98 |
#endif |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
#define SEGBASE_FS 0 |
| 106 |
#define SEGBASE_GS_USER 1 |
| 107 |
#define SEGBASE_GS_KERNEL 2 |
| 108 |
#define SEGBASE_GS_USER_SEL 3 |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
#define _VGCF_in_syscall 8 |
| 132 |
#define VGCF_in_syscall (1<<_VGCF_in_syscall) |
| 133 |
#define VGCF_IN_SYSCALL VGCF_in_syscall |
| 134 |
|
| 135 |
#ifndef __ASSEMBLY__ |
| 136 |
|
| 137 |
struct iret_context { |
| 138 |
|
| 139 |
uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss; |
| 140 |
|
| 141 |
}; |
| 142 |
|
| 143 |
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) |
| 144 |
|
| 145 |
#define __DECL_REG(name) union { \ |
| 146 |
uint64_t r ## name, e ## name; \ |
| 147 |
uint32_t _e ## name; \ |
| 148 |
} |
| 149 |
#else |
| 150 |
|
| 151 |
#define __DECL_REG(name) uint64_t r ## name |
| 152 |
#endif |
| 153 |
|
| 154 |
struct cpu_user_regs { |
| 155 |
uint64_t r15; |
| 156 |
uint64_t r14; |
| 157 |
uint64_t r13; |
| 158 |
uint64_t r12; |
| 159 |
__DECL_REG(bp); |
| 160 |
__DECL_REG(bx); |
| 161 |
uint64_t r11; |
| 162 |
uint64_t r10; |
| 163 |
uint64_t r9; |
| 164 |
uint64_t r8; |
| 165 |
__DECL_REG(ax); |
| 166 |
__DECL_REG(cx); |
| 167 |
__DECL_REG(dx); |
| 168 |
__DECL_REG(si); |
| 169 |
__DECL_REG(di); |
| 170 |
uint32_t error_code; |
| 171 |
uint32_t entry_vector; |
| 172 |
__DECL_REG(ip); |
| 173 |
uint16_t cs, _pad0[1]; |
| 174 |
uint8_t saved_upcall_mask; |
| 175 |
uint8_t _pad1[3]; |
| 176 |
__DECL_REG(flags); |
| 177 |
__DECL_REG(sp); |
| 178 |
uint16_t ss, _pad2[3]; |
| 179 |
uint16_t es, _pad3[3]; |
| 180 |
uint16_t ds, _pad4[3]; |
| 181 |
uint16_t fs, _pad5[3]; |
| 182 |
uint16_t gs, _pad6[3]; |
| 183 |
}; |
| 184 |
typedef struct cpu_user_regs cpu_user_regs_t; |
| 185 |
DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t); |
| 186 |
|
| 187 |
#undef __DECL_REG |
| 188 |
|
| 189 |
#define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12) |
| 190 |
#define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12) |
| 191 |
|
| 192 |
struct arch_vcpu_info { |
| 193 |
unsigned long cr2; |
| 194 |
unsigned long pad; |
| 195 |
}; |
| 196 |
typedef struct arch_vcpu_info arch_vcpu_info_t; |
| 197 |
|
| 198 |
typedef unsigned long xen_callback_t; |
| 199 |
|
| 200 |
#endif |
| 201 |
|
| 202 |
#endif |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|