| 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_32_H__ |
| 28 |
#define __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__ |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#if __XEN_INTERFACE_VERSION__ < 0x00030203 |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#define TRAP_INSTR "int $0x82" |
| 46 |
#endif |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
#define FLAT_RING1_CS 0xe019 |
| 54 |
#define FLAT_RING1_DS 0xe021 |
| 55 |
#define FLAT_RING1_SS 0xe021 |
| 56 |
#define FLAT_RING3_CS 0xe02b |
| 57 |
#define FLAT_RING3_DS 0xe033 |
| 58 |
#define FLAT_RING3_SS 0xe033 |
| 59 |
|
| 60 |
#define FLAT_KERNEL_CS FLAT_RING1_CS |
| 61 |
#define FLAT_KERNEL_DS FLAT_RING1_DS |
| 62 |
#define FLAT_KERNEL_SS FLAT_RING1_SS |
| 63 |
#define FLAT_USER_CS FLAT_RING3_CS |
| 64 |
#define FLAT_USER_DS FLAT_RING3_DS |
| 65 |
#define FLAT_USER_SS FLAT_RING3_SS |
| 66 |
|
| 67 |
#define __HYPERVISOR_VIRT_START_PAE 0xF5800000 |
| 68 |
#define __MACH2PHYS_VIRT_START_PAE 0xF5800000 |
| 69 |
#define __MACH2PHYS_VIRT_END_PAE 0xF6800000 |
| 70 |
#define HYPERVISOR_VIRT_START_PAE \ |
| 71 |
mk_unsigned_long(__HYPERVISOR_VIRT_START_PAE) |
| 72 |
#define MACH2PHYS_VIRT_START_PAE \ |
| 73 |
mk_unsigned_long(__MACH2PHYS_VIRT_START_PAE) |
| 74 |
#define MACH2PHYS_VIRT_END_PAE \ |
| 75 |
mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE) |
| 76 |
|
| 77 |
|
| 78 |
#define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000 |
| 79 |
#define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000 |
| 80 |
#define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000 |
| 81 |
#define HYPERVISOR_VIRT_START_NONPAE \ |
| 82 |
mk_unsigned_long(__HYPERVISOR_VIRT_START_NONPAE) |
| 83 |
#define MACH2PHYS_VIRT_START_NONPAE \ |
| 84 |
mk_unsigned_long(__MACH2PHYS_VIRT_START_NONPAE) |
| 85 |
#define MACH2PHYS_VIRT_END_NONPAE \ |
| 86 |
mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE) |
| 87 |
|
| 88 |
#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE |
| 89 |
#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE |
| 90 |
#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE |
| 91 |
|
| 92 |
#ifndef HYPERVISOR_VIRT_START |
| 93 |
#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) |
| 94 |
#endif |
| 95 |
|
| 96 |
#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) |
| 97 |
#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) |
| 98 |
#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2) |
| 99 |
#ifndef machine_to_phys_mapping |
| 100 |
#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START) |
| 101 |
#endif |
| 102 |
|
| 103 |
|
| 104 |
#if defined(__XEN__) || defined(__XEN_TOOLS__) |
| 105 |
#undef ___DEFINE_XEN_GUEST_HANDLE |
| 106 |
#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ |
| 107 |
typedef struct { type *p; } \ |
| 108 |
__guest_handle_ ## name; \ |
| 109 |
typedef struct { union { type *p; uint64_aligned_t q; }; } \ |
| 110 |
__guest_handle_64_ ## name |
| 111 |
#undef set_xen_guest_handle |
| 112 |
#define set_xen_guest_handle(hnd, val) \ |
| 113 |
do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \ |
| 114 |
(hnd).p = val; \ |
| 115 |
} while ( 0 ) |
| 116 |
#define uint64_aligned_t uint64_t __attribute__((aligned(8))) |
| 117 |
#define __XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name |
| 118 |
#define XEN_GUEST_HANDLE_64(name) __XEN_GUEST_HANDLE_64(name) |
| 119 |
#endif |
| 120 |
|
| 121 |
#ifndef __ASSEMBLY__ |
| 122 |
|
| 123 |
struct cpu_user_regs { |
| 124 |
uint32_t ebx; |
| 125 |
uint32_t ecx; |
| 126 |
uint32_t edx; |
| 127 |
uint32_t esi; |
| 128 |
uint32_t edi; |
| 129 |
uint32_t ebp; |
| 130 |
uint32_t eax; |
| 131 |
uint16_t error_code; |
| 132 |
uint16_t entry_vector; |
| 133 |
uint32_t eip; |
| 134 |
uint16_t cs; |
| 135 |
uint8_t saved_upcall_mask; |
| 136 |
uint8_t _pad0; |
| 137 |
uint32_t eflags; |
| 138 |
uint32_t esp; |
| 139 |
uint16_t ss, _pad1; |
| 140 |
uint16_t es, _pad2; |
| 141 |
uint16_t ds, _pad3; |
| 142 |
uint16_t fs, _pad4; |
| 143 |
uint16_t gs, _pad5; |
| 144 |
}; |
| 145 |
typedef struct cpu_user_regs cpu_user_regs_t; |
| 146 |
DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t); |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20)) |
| 154 |
#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20)) |
| 155 |
|
| 156 |
struct arch_vcpu_info { |
| 157 |
unsigned long cr2; |
| 158 |
unsigned long pad[5]; |
| 159 |
}; |
| 160 |
typedef struct arch_vcpu_info arch_vcpu_info_t; |
| 161 |
|
| 162 |
struct xen_callback { |
| 163 |
unsigned long cs; |
| 164 |
unsigned long eip; |
| 165 |
}; |
| 166 |
typedef struct xen_callback xen_callback_t; |
| 167 |
|
| 168 |
#endif |
| 169 |
|
| 170 |
#endif |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|