diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:13 -0500 |
commit | 80fbb69a8d1268ef48dfe21da80e68cb01922f31 (patch) | |
tree | 6cc2d5d0fdc40eb53f74e36c5557fa24f89edce0 /include/asm-x86 | |
parent | 5af725026fe902bf81f1b90b1b9d9ee4b9e1eb6a (diff) |
x86: introduce fill_ldt
This patch introduces fill_ldt(), which populates a ldt descriptor
from a user_desc in once, instead of relying in the LDT_entry_a and
LDT_entry_b macros
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/desc.h | 29 | ||||
-rw-r--r-- | include/asm-x86/desc_32.h | 15 | ||||
-rw-r--r-- | include/asm-x86/desc_64.h | 17 |
3 files changed, 29 insertions, 32 deletions
diff --git a/include/asm-x86/desc.h b/include/asm-x86/desc.h index 6065c5092265..47086d2d9298 100644 --- a/include/asm-x86/desc.h +++ b/include/asm-x86/desc.h | |||
@@ -1,5 +1,34 @@ | |||
1 | #ifndef _ASM_DESC_H_ | ||
2 | #define _ASM_DESC_H_ | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <asm/desc_defs.h> | ||
6 | #include <asm/ldt.h> | ||
7 | |||
8 | static inline void fill_ldt(struct desc_struct *desc, struct user_desc *info) | ||
9 | { | ||
10 | desc->limit0 = info->limit & 0x0ffff; | ||
11 | desc->base0 = info->base_addr & 0x0000ffff; | ||
12 | |||
13 | desc->base1 = (info->base_addr & 0x00ff0000) >> 16; | ||
14 | desc->type = (info->read_exec_only ^ 1) << 1; | ||
15 | desc->type |= info->contents << 2; | ||
16 | desc->s = 1; | ||
17 | desc->dpl = 0x3; | ||
18 | desc->p = info->seg_not_present ^ 1; | ||
19 | desc->limit = (info->limit & 0xf0000) >> 16; | ||
20 | desc->avl = info->useable; | ||
21 | desc->d = info->seg_32bit; | ||
22 | desc->g = info->limit_in_pages; | ||
23 | desc->base2 = (info->base_addr & 0xff000000) >> 24; | ||
24 | } | ||
25 | |||
26 | #endif | ||
27 | |||
1 | #ifdef CONFIG_X86_32 | 28 | #ifdef CONFIG_X86_32 |
2 | # include "desc_32.h" | 29 | # include "desc_32.h" |
3 | #else | 30 | #else |
4 | # include "desc_64.h" | 31 | # include "desc_64.h" |
5 | #endif | 32 | #endif |
33 | |||
34 | #endif | ||
diff --git a/include/asm-x86/desc_32.h b/include/asm-x86/desc_32.h index 54b2314f2ddf..03700991c5db 100644 --- a/include/asm-x86/desc_32.h +++ b/include/asm-x86/desc_32.h | |||
@@ -163,21 +163,6 @@ static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const vo | |||
163 | 163 | ||
164 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) | 164 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) |
165 | 165 | ||
166 | #define LDT_entry_a(info) \ | ||
167 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
168 | |||
169 | #define LDT_entry_b(info) \ | ||
170 | (((info)->base_addr & 0xff000000) | \ | ||
171 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
172 | ((info)->limit & 0xf0000) | \ | ||
173 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
174 | ((info)->contents << 10) | \ | ||
175 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
176 | ((info)->seg_32bit << 22) | \ | ||
177 | ((info)->limit_in_pages << 23) | \ | ||
178 | ((info)->useable << 20) | \ | ||
179 | 0x7000) | ||
180 | |||
181 | #define LDT_empty(info) (\ | 166 | #define LDT_empty(info) (\ |
182 | (info)->base_addr == 0 && \ | 167 | (info)->base_addr == 0 && \ |
183 | (info)->limit == 0 && \ | 168 | (info)->limit == 0 && \ |
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h index c49f928ed8b6..ba7fb87d10f3 100644 --- a/include/asm-x86/desc_64.h +++ b/include/asm-x86/desc_64.h | |||
@@ -147,23 +147,6 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size) | |||
147 | (unsigned long)addr, DESC_LDT, size * 8 - 1); | 147 | (unsigned long)addr, DESC_LDT, size * 8 - 1); |
148 | } | 148 | } |
149 | 149 | ||
150 | #define LDT_entry_a(info) \ | ||
151 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
152 | /* Don't allow setting of the lm bit. It is useless anyways because | ||
153 | 64bit system calls require __USER_CS. */ | ||
154 | #define LDT_entry_b(info) \ | ||
155 | (((info)->base_addr & 0xff000000) | \ | ||
156 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
157 | ((info)->limit & 0xf0000) | \ | ||
158 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
159 | ((info)->contents << 10) | \ | ||
160 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
161 | ((info)->seg_32bit << 22) | \ | ||
162 | ((info)->limit_in_pages << 23) | \ | ||
163 | ((info)->useable << 20) | \ | ||
164 | /* ((info)->lm << 21) | */ \ | ||
165 | 0x7000) | ||
166 | |||
167 | #define LDT_empty(info) (\ | 150 | #define LDT_empty(info) (\ |
168 | (info)->base_addr == 0 && \ | 151 | (info)->base_addr == 0 && \ |
169 | (info)->limit == 0 && \ | 152 | (info)->limit == 0 && \ |