Glauber de Oliveira Costa | cef1895 | 2008-01-30 13:31:09 +0100 | [diff] [blame] | 1 | #ifndef _ASM_X86_SEGMENT_H_ |
| 2 | #define _ASM_X86_SEGMENT_H_ |
| 3 | |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 4 | #ifdef CONFIG_X86_32 |
| 5 | # include "segment_32.h" |
| 6 | #else |
| 7 | # include "segment_64.h" |
| 8 | #endif |
Glauber de Oliveira Costa | cef1895 | 2008-01-30 13:31:09 +0100 | [diff] [blame] | 9 | |
| 10 | #ifndef CONFIG_PARAVIRT |
| 11 | #define get_kernel_rpl() 0 |
| 12 | #endif |
| 13 | |
Glauber de Oliveira Costa | 15ee09b | 2008-01-30 13:31:09 +0100 | [diff] [blame^] | 14 | /* User mode is privilege level 3 */ |
| 15 | #define USER_RPL 0x3 |
| 16 | /* LDT segment has TI set, GDT has it cleared */ |
| 17 | #define SEGMENT_LDT 0x4 |
| 18 | #define SEGMENT_GDT 0x0 |
| 19 | |
| 20 | /* Bottom two bits of selector give the ring privilege level */ |
| 21 | #define SEGMENT_RPL_MASK 0x3 |
| 22 | /* Bit 2 is table indicator (LDT/GDT) */ |
| 23 | #define SEGMENT_TI_MASK 0x4 |
| 24 | |
| 25 | #define IDT_ENTRIES 256 |
| 26 | #define GDT_SIZE (GDT_ENTRIES * 8) |
| 27 | #define GDT_ENTRY_TLS_ENTRIES 3 |
| 28 | #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) |
| 29 | |
Glauber de Oliveira Costa | cef1895 | 2008-01-30 13:31:09 +0100 | [diff] [blame] | 30 | #endif |