Xen Test Framework
xen-x86_32.h
Go to the documentation of this file.
1#ifndef XEN_PUBLIC_ARCH_X86_XEN_X86_32_H
2#define XEN_PUBLIC_ARCH_X86_XEN_X86_32_H
3
4/*
5 * These flat segments are in the Xen-private section of every GDT. Since these
6 * are also present in the initial GDT, many OSes will be able to avoid
7 * installing their own GDT.
8 */
9#define FLAT_RING1_CS 0xe019 /* GDT index 259 */
10#define FLAT_RING1_DS 0xe021 /* GDT index 260 */
11#define FLAT_RING1_SS 0xe021 /* GDT index 260 */
12#define FLAT_RING3_CS 0xe02b /* GDT index 261 */
13#define FLAT_RING3_DS 0xe033 /* GDT index 262 */
14#define FLAT_RING3_SS 0xe033 /* GDT index 262 */
15
16#define MACH2PHYS_VIRT_START 0xF5800000UL
17
18#define __HYPERVISOR_VIRT_START_PAE 0xF5800000UL
19
20#ifndef __ASSEMBLY__
21
22/* Anonymous unions include all permissible names (e.g., al/ah/ax/eax). */
23#define __DECL_REG_LO8(which) union { \
24 uint32_t e ## which ## x; \
25 uint16_t which ## x; \
26 struct { \
27 uint8_t which ## l; \
28 uint8_t which ## h; \
29 }; \
30}
31#define __DECL_REG_LO16(name) union { \
32 uint32_t e ## name, _e ## name; \
33 uint16_t name; \
34}
35
44 uint16_t error_code; /* private */
45 uint16_t entry_vector; /* private */
50 __DECL_REG_LO16(flags); /* eflags.IF == !saved_upcall_mask */
57};
58
59#undef __DECL_REG_LO8
60#undef __DECL_REG_LO16
61
62/*
63 * Page-directory addresses above 4GB do not fit into architectural %cr3.
64 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
65 * must use the following accessor macros to pack/unpack valid MFNs.
66 */
67static inline unsigned int xen_pfn_to_cr3(unsigned int pfn)
68{
69 return pfn << 12 | pfn >> 20;
70}
71
72static inline unsigned int xen_cr3_to_pfn(unsigned int cr3)
73{
74 return cr3 >> 12 | cr3 << 20;
75}
76
78 unsigned long cr2;
79 unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
80};
81
83 unsigned long cs;
84 unsigned long eip;
85};
87
88#define INIT_XEN_CALLBACK(_cs, _ip) \
89 ((xen_callback_t){ .cs = _cs, .eip = _ip })
90
91#endif /* __ASSEMBLY__ */
92
93#endif /* XEN_PUBLIC_ARCH_X86_XEN_X86_32_H */
94
95/*
96 * Local variables:
97 * mode: C
98 * c-file-style: "BSD"
99 * c-basic-offset: 4
100 * tab-width: 4
101 * indent-tabs-mode: nil
102 * End:
103 */
__UINT8_TYPE__ uint8_t
Definition: stdint.h:14
__UINT16_TYPE__ uint16_t
Definition: stdint.h:15
unsigned long pad[5]
Definition: xen-x86_32.h:79
unsigned long cr2
Definition: xen-x86_32.h:78
unsigned long eip
Definition: xen-x86_32.h:84
unsigned long cs
Definition: xen-x86_32.h:83
uint16_t _pad4
Definition: xen-x86_32.h:55
uint16_t entry_vector
Definition: xen-x86_32.h:45
uint16_t error_code
Definition: xen-x86_32.h:44
uint16_t _pad2
Definition: xen-x86_32.h:53
uint16_t _pad1
Definition: xen-x86_32.h:52
uint16_t _pad3
Definition: xen-x86_32.h:54
uint8_t saved_upcall_mask
Definition: xen-x86_32.h:48
uint16_t _pad5
Definition: xen-x86_32.h:56
static unsigned int xen_cr3_to_pfn(unsigned int cr3)
Definition: xen-x86_32.h:72
static unsigned int xen_pfn_to_cr3(unsigned int pfn)
Definition: xen-x86_32.h:67