| .. | .. |
|---|
| 31 | 31 | */ |
|---|
| 32 | 32 | #define SEGMENT_RPL_MASK 0x3 |
|---|
| 33 | 33 | |
|---|
| 34 | +/* |
|---|
| 35 | + * When running on Xen PV, the actual privilege level of the kernel is 1, |
|---|
| 36 | + * not 0. Testing the Requested Privilege Level in a segment selector to |
|---|
| 37 | + * determine whether the context is user mode or kernel mode with |
|---|
| 38 | + * SEGMENT_RPL_MASK is wrong because the PV kernel's privilege level |
|---|
| 39 | + * matches the 0x3 mask. |
|---|
| 40 | + * |
|---|
| 41 | + * Testing with USER_SEGMENT_RPL_MASK is valid for both native and Xen PV |
|---|
| 42 | + * kernels because privilege level 2 is never used. |
|---|
| 43 | + */ |
|---|
| 44 | +#define USER_SEGMENT_RPL_MASK 0x2 |
|---|
| 45 | + |
|---|
| 34 | 46 | /* User mode is privilege level 3: */ |
|---|
| 35 | 47 | #define USER_RPL 0x3 |
|---|
| 36 | 48 | |
|---|
| .. | .. |
|---|
| 210 | 222 | |
|---|
| 211 | 223 | #endif |
|---|
| 212 | 224 | |
|---|
| 213 | | -#ifndef CONFIG_PARAVIRT |
|---|
| 214 | | -# define get_kernel_rpl() 0 |
|---|
| 215 | | -#endif |
|---|
| 216 | | - |
|---|
| 217 | 225 | #define IDT_ENTRIES 256 |
|---|
| 218 | 226 | #define NUM_EXCEPTION_VECTORS 32 |
|---|
| 219 | 227 | |
|---|
| 220 | 228 | /* Bitmask of exception vectors which push an error code on the stack: */ |
|---|
| 221 | | -#define EXCEPTION_ERRCODE_MASK 0x00027d00 |
|---|
| 229 | +#define EXCEPTION_ERRCODE_MASK 0x20027d00 |
|---|
| 222 | 230 | |
|---|
| 223 | 231 | #define GDT_SIZE (GDT_ENTRIES*8) |
|---|
| 224 | 232 | #define GDT_ENTRY_TLS_ENTRIES 3 |
|---|
| .. | .. |
|---|
| 289 | 297 | extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_SIZE]; |
|---|
| 290 | 298 | extern void early_ignore_irq(void); |
|---|
| 291 | 299 | |
|---|
| 292 | | -#if defined(CONFIG_X86_64) && defined(CONFIG_XEN_PV) |
|---|
| 300 | +#ifdef CONFIG_XEN_PV |
|---|
| 293 | 301 | extern const char xen_early_idt_handler_array[NUM_EXCEPTION_VECTORS][XEN_EARLY_IDT_HANDLER_SIZE]; |
|---|
| 294 | 302 | #endif |
|---|
| 295 | 303 | |
|---|