Xen Test Framework
include
xen
arch-x86
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
36
struct
xen_cpu_user_regs
{
37
__DECL_REG_LO8
(b);
38
__DECL_REG_LO8
(c);
39
__DECL_REG_LO8
(d);
40
__DECL_REG_LO16
(si);
41
__DECL_REG_LO16
(di);
42
__DECL_REG_LO16
(bp);
43
__DECL_REG_LO8
(a);
44
uint16_t
error_code
;
/* private */
45
uint16_t
entry_vector
;
/* private */
46
__DECL_REG_LO16
(ip);
47
uint16_t
cs
;
48
uint8_t
saved_upcall_mask
;
49
uint8_t
_pad0
;
50
__DECL_REG_LO16
(flags);
/* eflags.IF == !saved_upcall_mask */
51
__DECL_REG_LO16
(sp);
52
uint16_t
ss
,
_pad1
;
53
uint16_t
es
,
_pad2
;
54
uint16_t
ds
,
_pad3
;
55
uint16_t
fs
,
_pad4
;
56
uint16_t
gs
,
_pad5
;
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
*/
67
static
inline
unsigned
int
xen_pfn_to_cr3
(
unsigned
int
pfn)
68
{
69
return
pfn << 12 | pfn >> 20;
70
}
71
72
static
inline
unsigned
int
xen_cr3_to_pfn
(
unsigned
int
cr3)
73
{
74
return
cr3 >> 12 | cr3 << 20;
75
}
76
77
struct
arch_vcpu_info
{
78
unsigned
long
cr2
;
79
unsigned
long
pad
[5];
/* sizeof(vcpu_info_t) == 64 */
80
};
81
82
struct
xen_callback
{
83
unsigned
long
cs
;
84
unsigned
long
eip
;
85
};
86
typedef
struct
xen_callback
xen_callback_t
;
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_t
__UINT8_TYPE__ uint8_t
Definition:
stdint.h:14
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:15
arch_vcpu_info
Definition:
xen-x86_32.h:77
arch_vcpu_info::pad
unsigned long pad[5]
Definition:
xen-x86_32.h:79
arch_vcpu_info::cr2
unsigned long cr2
Definition:
xen-x86_32.h:78
xen_callback
Definition:
xen-x86_32.h:82
xen_callback::eip
unsigned long eip
Definition:
xen-x86_32.h:84
xen_callback::cs
unsigned long cs
Definition:
xen-x86_32.h:83
xen_cpu_user_regs
Definition:
xen-x86_32.h:36
xen_cpu_user_regs::fs
uint16_t fs
Definition:
xen-x86_32.h:55
xen_cpu_user_regs::ss
uint16_t ss
Definition:
xen-x86_32.h:52
xen_cpu_user_regs::ds
uint16_t ds
Definition:
xen-x86_32.h:54
xen_cpu_user_regs::_pad4
uint16_t _pad4
Definition:
xen-x86_32.h:55
xen_cpu_user_regs::__DECL_REG_LO8
__DECL_REG_LO8(d)
xen_cpu_user_regs::__DECL_REG_LO16
__DECL_REG_LO16(sp)
xen_cpu_user_regs::__DECL_REG_LO8
__DECL_REG_LO8(c)
xen_cpu_user_regs::cs
uint16_t cs
Definition:
xen-x86_32.h:47
xen_cpu_user_regs::__DECL_REG_LO16
__DECL_REG_LO16(si)
xen_cpu_user_regs::gs
uint16_t gs
Definition:
xen-x86_32.h:56
xen_cpu_user_regs::entry_vector
uint16_t entry_vector
Definition:
xen-x86_32.h:45
xen_cpu_user_regs::error_code
uint16_t error_code
Definition:
xen-x86_32.h:44
xen_cpu_user_regs::_pad0
uint8_t _pad0
Definition:
xen-x86_32.h:49
xen_cpu_user_regs::_pad2
uint16_t _pad2
Definition:
xen-x86_32.h:53
xen_cpu_user_regs::__DECL_REG_LO16
__DECL_REG_LO16(ip)
xen_cpu_user_regs::__DECL_REG_LO16
__DECL_REG_LO16(flags)
xen_cpu_user_regs::_pad1
uint16_t _pad1
Definition:
xen-x86_32.h:52
xen_cpu_user_regs::__DECL_REG_LO16
__DECL_REG_LO16(di)
xen_cpu_user_regs::_pad3
uint16_t _pad3
Definition:
xen-x86_32.h:54
xen_cpu_user_regs::__DECL_REG_LO8
__DECL_REG_LO8(a)
xen_cpu_user_regs::__DECL_REG_LO8
__DECL_REG_LO8(b)
xen_cpu_user_regs::saved_upcall_mask
uint8_t saved_upcall_mask
Definition:
xen-x86_32.h:48
xen_cpu_user_regs::es
uint16_t es
Definition:
xen-x86_32.h:53
xen_cpu_user_regs::_pad5
uint16_t _pad5
Definition:
xen-x86_32.h:56
xen_cpu_user_regs::__DECL_REG_LO16
__DECL_REG_LO16(bp)
xen_cr3_to_pfn
static unsigned int xen_cr3_to_pfn(unsigned int cr3)
Definition:
xen-x86_32.h:72
xen_pfn_to_cr3
static unsigned int xen_pfn_to_cr3(unsigned int pfn)
Definition:
xen-x86_32.h:67
Generated by
1.9.4