Xen Test Framework
desc.c
Go to the documentation of this file.
1 #include <xtf/numbers.h>
2 
3 #include <arch/desc.h>
4 #include <arch/segment.h>
5 #include <arch/symbolic-const.h>
6 
7 #ifdef CONFIG_HVM
8 #define gdt_section __page_aligned_data
9 #else
10 #define gdt_section __page_aligned_bss
11 #endif
12 
13 user_desc gdt[NR_GDT_ENTRIES] gdt_section = /* lgtm [cpp/short-global-name] */
14 {
15 #ifdef CONFIG_HVM
16  [GDTE_CS64_DPL0] = INIT_GDTE_SYM(0, 0xfffff, COMMON, CODE, DPL0, R, L),
17  [GDTE_CS32_DPL0] = INIT_GDTE_SYM(0, 0xfffff, COMMON, CODE, DPL0, R, D),
18  [GDTE_DS32_DPL0] = INIT_GDTE_SYM(0, 0xfffff, COMMON, DATA, DPL0, B, W),
19 
20  [GDTE_CS64_DPL3] = INIT_GDTE_SYM(0, 0xfffff, COMMON, CODE, DPL3, R, L),
21  [GDTE_CS32_DPL3] = INIT_GDTE_SYM(0, 0xfffff, COMMON, CODE, DPL3, R, D),
22  [GDTE_DS32_DPL3] = INIT_GDTE_SYM(0, 0xfffff, COMMON, DATA, DPL3, B, W),
23 
24  /* [GDTE_TSS] */
25  /* [GDTE_TSS + 1] */
26 #endif
27 };
28 
29 #if defined(CONFIG_HVM)
30 
31 desc_ptr gdt_ptr =
32 {
33  .limit = sizeof(gdt) - 1,
34  .base = _u(&gdt),
35 };
36 
37 env_gate idt[256]; /* lgtm [cpp/short-global-name] */
38 
39 desc_ptr idt_ptr =
40 {
41  .limit = sizeof(idt) - 1,
42  .base = _u(&idt),
43 };
44 
45 #endif
46 
47 /*
48  * Local variables:
49  * mode: C
50  * c-file-style: "BSD"
51  * c-basic-offset: 4
52  * tab-width: 4
53  * indent-tabs-mode: nil
54  * End:
55  */
Macros for creating constants using mnemonics.
#define GDTE_CS32_DPL3
Definition: segment.h:31
x86 segment descriptor infrastructure.
#define _u(v)
Express an arbitrary value v as unsigned long.
Definition: numbers.h:53
#define INIT_GDTE_SYM(base, limit,...)
Initialiser for an LDT/GDT entry using SEG_ATTR_ mnemonics.
#define GDTE_DS32_DPL0
Definition: segment.h:29
Primatives for number manipulation.
desc_ptr gdt_ptr
#define GDTE_CS64_DPL0
Definition: segment.h:27
user_desc gdt[NR_GDT_ENTRIES]
#define GDTE_DS32_DPL3
Definition: segment.h:32
#define GDTE_CS32_DPL0
Definition: segment.h:28
#define GDTE_CS64_DPL3
Definition: segment.h:30
#define NR_GDT_ENTRIES
Definition: segment.h:44
#define gdt_section
Definition: desc.c:10