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/desc.h | |
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/desc.h')
-rw-r--r-- | include/asm-x86/desc.h | 29 |
1 files changed, 29 insertions, 0 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 | ||