diff options
Diffstat (limited to 'include/asm-x86/segment.h')
| -rw-r--r-- | include/asm-x86/segment.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/include/asm-x86/segment.h b/include/asm-x86/segment.h index ed5131dd7d92..dfc8601c0892 100644 --- a/include/asm-x86/segment.h +++ b/include/asm-x86/segment.h | |||
| @@ -61,18 +61,14 @@ | |||
| 61 | #define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1) | 61 | #define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1) |
| 62 | 62 | ||
| 63 | #define GDT_ENTRY_DEFAULT_USER_CS 14 | 63 | #define GDT_ENTRY_DEFAULT_USER_CS 14 |
| 64 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS * 8 + 3) | ||
| 65 | 64 | ||
| 66 | #define GDT_ENTRY_DEFAULT_USER_DS 15 | 65 | #define GDT_ENTRY_DEFAULT_USER_DS 15 |
| 67 | #define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS * 8 + 3) | ||
| 68 | 66 | ||
| 69 | #define GDT_ENTRY_KERNEL_BASE 12 | 67 | #define GDT_ENTRY_KERNEL_BASE 12 |
| 70 | 68 | ||
| 71 | #define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE + 0) | 69 | #define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE + 0) |
| 72 | #define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8) | ||
| 73 | 70 | ||
| 74 | #define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1) | 71 | #define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1) |
| 75 | #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8) | ||
| 76 | 72 | ||
| 77 | #define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4) | 73 | #define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4) |
| 78 | #define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5) | 74 | #define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5) |
| @@ -139,10 +135,11 @@ | |||
| 139 | #else | 135 | #else |
| 140 | #include <asm/cache.h> | 136 | #include <asm/cache.h> |
| 141 | 137 | ||
| 142 | #define __KERNEL_CS 0x10 | 138 | #define GDT_ENTRY_KERNEL32_CS 1 |
| 143 | #define __KERNEL_DS 0x18 | 139 | #define GDT_ENTRY_KERNEL_CS 2 |
| 140 | #define GDT_ENTRY_KERNEL_DS 3 | ||
| 144 | 141 | ||
| 145 | #define __KERNEL32_CS 0x08 | 142 | #define __KERNEL32_CS (GDT_ENTRY_KERNEL32_CS * 8) |
| 146 | 143 | ||
| 147 | /* | 144 | /* |
| 148 | * we cannot use the same code segment descriptor for user and kernel | 145 | * we cannot use the same code segment descriptor for user and kernel |
| @@ -150,10 +147,10 @@ | |||
| 150 | * The segment offset needs to contain a RPL. Grr. -AK | 147 | * The segment offset needs to contain a RPL. Grr. -AK |
| 151 | * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets) | 148 | * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets) |
| 152 | */ | 149 | */ |
| 153 | 150 | #define GDT_ENTRY_DEFAULT_USER32_CS 4 | |
| 154 | #define __USER32_CS 0x23 /* 4*8+3 */ | 151 | #define GDT_ENTRY_DEFAULT_USER_DS 5 |
| 155 | #define __USER_DS 0x2b /* 5*8+3 */ | 152 | #define GDT_ENTRY_DEFAULT_USER_CS 6 |
| 156 | #define __USER_CS 0x33 /* 6*8+3 */ | 153 | #define __USER32_CS (GDT_ENTRY_DEFAULT_USER32_CS * 8 + 3) |
| 157 | #define __USER32_DS __USER_DS | 154 | #define __USER32_DS __USER_DS |
| 158 | 155 | ||
| 159 | #define GDT_ENTRY_TSS 8 /* needs two entries */ | 156 | #define GDT_ENTRY_TSS 8 /* needs two entries */ |
| @@ -175,6 +172,10 @@ | |||
| 175 | 172 | ||
| 176 | #endif | 173 | #endif |
| 177 | 174 | ||
| 175 | #define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8) | ||
| 176 | #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8) | ||
| 177 | #define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS* 8 + 3) | ||
| 178 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS* 8 + 3) | ||
| 178 | #ifndef CONFIG_PARAVIRT | 179 | #ifndef CONFIG_PARAVIRT |
| 179 | #define get_kernel_rpl() 0 | 180 | #define get_kernel_rpl() 0 |
| 180 | #endif | 181 | #endif |
