This source file includes following definitions.
- cpu_entry_stack
1
2
3 #ifndef _ASM_X86_CPU_ENTRY_AREA_H
4 #define _ASM_X86_CPU_ENTRY_AREA_H
5
6 #include <linux/percpu-defs.h>
7 #include <asm/processor.h>
8 #include <asm/intel_ds.h>
9
10 #ifdef CONFIG_X86_64
11
12
13 #define ESTACKS_MEMBERS(guardsize, db2_holesize)\
14 char DF_stack_guard[guardsize]; \
15 char DF_stack[EXCEPTION_STKSZ]; \
16 char NMI_stack_guard[guardsize]; \
17 char NMI_stack[EXCEPTION_STKSZ]; \
18 char DB2_stack_guard[guardsize]; \
19 char DB2_stack[db2_holesize]; \
20 char DB1_stack_guard[guardsize]; \
21 char DB1_stack[EXCEPTION_STKSZ]; \
22 char DB_stack_guard[guardsize]; \
23 char DB_stack[EXCEPTION_STKSZ]; \
24 char MCE_stack_guard[guardsize]; \
25 char MCE_stack[EXCEPTION_STKSZ]; \
26 char IST_top_guard[guardsize]; \
27
28
29 struct exception_stacks {
30 ESTACKS_MEMBERS(0, 0)
31 };
32
33
34 struct cea_exception_stacks {
35 ESTACKS_MEMBERS(PAGE_SIZE, EXCEPTION_STKSZ)
36 };
37
38
39
40
41 enum exception_stack_ordering {
42 ESTACK_DF,
43 ESTACK_NMI,
44 ESTACK_DB2,
45 ESTACK_DB1,
46 ESTACK_DB,
47 ESTACK_MCE,
48 N_EXCEPTION_STACKS
49 };
50
51 #define CEA_ESTACK_SIZE(st) \
52 sizeof(((struct cea_exception_stacks *)0)->st## _stack)
53
54 #define CEA_ESTACK_BOT(ceastp, st) \
55 ((unsigned long)&(ceastp)->st## _stack)
56
57 #define CEA_ESTACK_TOP(ceastp, st) \
58 (CEA_ESTACK_BOT(ceastp, st) + CEA_ESTACK_SIZE(st))
59
60 #define CEA_ESTACK_OFFS(st) \
61 offsetof(struct cea_exception_stacks, st## _stack)
62
63 #define CEA_ESTACK_PAGES \
64 (sizeof(struct cea_exception_stacks) / PAGE_SIZE)
65
66 #endif
67
68
69
70
71
72
73
74
75
76 struct cpu_entry_area {
77 char gdt[PAGE_SIZE];
78
79
80
81
82
83
84 #ifdef CONFIG_X86_32
85 char guard_entry_stack[PAGE_SIZE];
86 #endif
87 struct entry_stack_page entry_stack_page;
88
89
90
91
92
93 struct tss_struct tss;
94
95 #ifdef CONFIG_X86_64
96
97
98
99 struct cea_exception_stacks estacks;
100 #endif
101
102
103
104
105 struct debug_store cpu_debug_store;
106
107
108
109
110 struct debug_store_buffers cpu_debug_buffers;
111 };
112
113 #define CPU_ENTRY_AREA_SIZE (sizeof(struct cpu_entry_area))
114 #define CPU_ENTRY_AREA_ARRAY_SIZE (CPU_ENTRY_AREA_SIZE * NR_CPUS)
115
116
117 #define CPU_ENTRY_AREA_TOTAL_SIZE (CPU_ENTRY_AREA_ARRAY_SIZE + PAGE_SIZE)
118
119 DECLARE_PER_CPU(struct cpu_entry_area *, cpu_entry_area);
120 DECLARE_PER_CPU(struct cea_exception_stacks *, cea_exception_stacks);
121
122 extern void setup_cpu_entry_areas(void);
123 extern void cea_set_pte(void *cea_vaddr, phys_addr_t pa, pgprot_t flags);
124
125
126 #define CPU_ENTRY_AREA_RO_IDT CPU_ENTRY_AREA_BASE
127 #define CPU_ENTRY_AREA_PER_CPU (CPU_ENTRY_AREA_RO_IDT + PAGE_SIZE)
128
129 #define CPU_ENTRY_AREA_RO_IDT_VADDR ((void *)CPU_ENTRY_AREA_RO_IDT)
130
131 #define CPU_ENTRY_AREA_MAP_SIZE \
132 (CPU_ENTRY_AREA_PER_CPU + CPU_ENTRY_AREA_ARRAY_SIZE - CPU_ENTRY_AREA_BASE)
133
134 extern struct cpu_entry_area *get_cpu_entry_area(int cpu);
135
136 static inline struct entry_stack *cpu_entry_stack(int cpu)
137 {
138 return &get_cpu_entry_area(cpu)->entry_stack_page.stack;
139 }
140
141 #define __this_cpu_ist_top_va(name) \
142 CEA_ESTACK_TOP(__this_cpu_read(cea_exception_stacks), name)
143
144 #endif