diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:11 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:11 -0500 |
commit | 6842ef0e85a9cc1295f3ef933a230f863b01eb0f (patch) | |
tree | dfee4feb74f15ea3819b57848e59fb29ebb10750 /include | |
parent | 746ef0cd0c7190d570c65b8e39a4ac67550ae43a (diff) |
x86: unify desc_struct
This patch aims to make the access of struct desc_struct variables
equal across architectures. In this patch, I unify the i386 and x86_64
versions under an anonymous union, keeping the way they are accessed
untouched (a and b for 32-bit code, individual bit-fields for 64-bit).
This solution is not beautiful, but will allow us to integrate common
code that differed by the way descriptors were used. This is to be viewed
incrementally. There's simply too much code to be fixed at once.
In the future, goal is to set up in a single way of acessing
the desc_struct fields.
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')
-rw-r--r-- | include/asm-x86/desc_defs.h | 25 | ||||
-rw-r--r-- | include/asm-x86/lguest.h | 4 | ||||
-rw-r--r-- | include/asm-x86/processor_32.h | 5 |
3 files changed, 20 insertions, 14 deletions
diff --git a/include/asm-x86/desc_defs.h b/include/asm-x86/desc_defs.h index 089004070099..de47eb0a23aa 100644 --- a/include/asm-x86/desc_defs.h +++ b/include/asm-x86/desc_defs.h | |||
@@ -11,17 +11,26 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | 13 | ||
14 | /* | ||
15 | * FIXME: Acessing the desc_struct through its fields is more elegant, | ||
16 | * and should be the one valid thing to do. However, a lot of open code | ||
17 | * still touches the a and b acessors, and doing this allow us to do it | ||
18 | * incrementally. We keep the signature as a struct, rather than an union, | ||
19 | * so we can get rid of it transparently in the future -- glommer | ||
20 | */ | ||
14 | // 8 byte segment descriptor | 21 | // 8 byte segment descriptor |
15 | struct desc_struct { | 22 | struct desc_struct { |
16 | u16 limit0; | 23 | union { |
17 | u16 base0; | 24 | struct { unsigned int a, b; }; |
18 | unsigned base1 : 8, type : 4, s : 1, dpl : 2, p : 1; | 25 | struct { |
19 | unsigned limit : 4, avl : 1, l : 1, d : 1, g : 1, base2 : 8; | 26 | u16 limit0; |
20 | } __attribute__((packed)); | 27 | u16 base0; |
28 | unsigned base1: 8, type: 4, s: 1, dpl: 2, p: 1; | ||
29 | unsigned limit: 4, avl: 1, l: 1, d: 1, g: 1, base2: 8; | ||
30 | }; | ||
21 | 31 | ||
22 | struct n_desc_struct { | 32 | }; |
23 | unsigned int a,b; | 33 | } __attribute__((packed)); |
24 | }; | ||
25 | 34 | ||
26 | enum { | 35 | enum { |
27 | GATE_INTERRUPT = 0xE, | 36 | GATE_INTERRUPT = 0xE, |
diff --git a/include/asm-x86/lguest.h b/include/asm-x86/lguest.h index ccd338460811..17c908c0ef1c 100644 --- a/include/asm-x86/lguest.h +++ b/include/asm-x86/lguest.h | |||
@@ -78,8 +78,8 @@ static inline void lguest_set_ts(void) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* Full 4G segment descriptors, suitable for CS and DS. */ | 80 | /* Full 4G segment descriptors, suitable for CS and DS. */ |
81 | #define FULL_EXEC_SEGMENT ((struct desc_struct){0x0000ffff, 0x00cf9b00}) | 81 | #define FULL_EXEC_SEGMENT ((struct desc_struct){ { {0x0000ffff, 0x00cf9b00} } }) |
82 | #define FULL_SEGMENT ((struct desc_struct){0x0000ffff, 0x00cf9300}) | 82 | #define FULL_SEGMENT ((struct desc_struct){ { {0x0000ffff, 0x00cf9300} } }) |
83 | 83 | ||
84 | #endif /* __ASSEMBLY__ */ | 84 | #endif /* __ASSEMBLY__ */ |
85 | 85 | ||
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index 9c0ab7f26bd9..bc48ad64de47 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h | |||
@@ -20,14 +20,11 @@ | |||
20 | #include <linux/cpumask.h> | 20 | #include <linux/cpumask.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <asm/processor-flags.h> | 22 | #include <asm/processor-flags.h> |
23 | #include <asm/desc_defs.h> | ||
23 | 24 | ||
24 | /* flag for disabling the tsc */ | 25 | /* flag for disabling the tsc */ |
25 | extern int tsc_disable; | 26 | extern int tsc_disable; |
26 | 27 | ||
27 | struct desc_struct { | ||
28 | unsigned long a,b; | ||
29 | }; | ||
30 | |||
31 | static inline int desc_empty(const void *ptr) | 28 | static inline int desc_empty(const void *ptr) |
32 | { | 29 | { |
33 | const u32 *desc = ptr; | 30 | const u32 *desc = ptr; |