diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:09 -0500 |
commit | 15ee09b40831ae88eb8a804a647b6935eb8b7114 (patch) | |
tree | bbb9e9e09b3f058a59052d4e682619221dbd25ca /include/asm-x86 | |
parent | cef189508b2f043fdc2e354645803b6ce004aac3 (diff) |
x86: unify common parts of segment.h
Although segment handling in i386 and x86_64 are very different,
there's a common part. Put them in segment.h instead of arch specific
headers
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/segment.h | 16 | ||||
-rw-r--r-- | include/asm-x86/segment_32.h | 22 | ||||
-rw-r--r-- | include/asm-x86/segment_64.h | 17 |
3 files changed, 16 insertions, 39 deletions
diff --git a/include/asm-x86/segment.h b/include/asm-x86/segment.h index b3a7a3e9fb19..3c9b306bc4bf 100644 --- a/include/asm-x86/segment.h +++ b/include/asm-x86/segment.h | |||
@@ -11,4 +11,20 @@ | |||
11 | #define get_kernel_rpl() 0 | 11 | #define get_kernel_rpl() 0 |
12 | #endif | 12 | #endif |
13 | 13 | ||
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 | |||
14 | #endif | 30 | #endif |
diff --git a/include/asm-x86/segment_32.h b/include/asm-x86/segment_32.h index ff186e34798a..3e133ad4252d 100644 --- a/include/asm-x86/segment_32.h +++ b/include/asm-x86/segment_32.h | |||
@@ -45,12 +45,9 @@ | |||
45 | * 30 - unused | 45 | * 30 - unused |
46 | * 31 - TSS for double fault handler | 46 | * 31 - TSS for double fault handler |
47 | */ | 47 | */ |
48 | #define GDT_ENTRY_TLS_ENTRIES 3 | ||
49 | #define GDT_ENTRY_TLS_MIN 6 | 48 | #define GDT_ENTRY_TLS_MIN 6 |
50 | #define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1) | 49 | #define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1) |
51 | 50 | ||
52 | #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) | ||
53 | |||
54 | #define GDT_ENTRY_DEFAULT_USER_CS 14 | 51 | #define GDT_ENTRY_DEFAULT_USER_CS 14 |
55 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS * 8 + 3) | 52 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS * 8 + 3) |
56 | 53 | ||
@@ -87,7 +84,6 @@ | |||
87 | * The GDT has 32 entries | 84 | * The GDT has 32 entries |
88 | */ | 85 | */ |
89 | #define GDT_ENTRIES 32 | 86 | #define GDT_ENTRIES 32 |
90 | #define GDT_SIZE (GDT_ENTRIES * 8) | ||
91 | 87 | ||
92 | /* Simple and small GDT entries for booting only */ | 88 | /* Simple and small GDT entries for booting only */ |
93 | 89 | ||
@@ -112,24 +108,6 @@ | |||
112 | #define PNP_TS2 (GDT_ENTRY_PNPBIOS_TS2 * 8) /* another data segment */ | 108 | #define PNP_TS2 (GDT_ENTRY_PNPBIOS_TS2 * 8) /* another data segment */ |
113 | 109 | ||
114 | /* | 110 | /* |
115 | * The interrupt descriptor table has room for 256 idt's, | ||
116 | * the global descriptor table is dependent on the number | ||
117 | * of tasks we can have.. | ||
118 | */ | ||
119 | #define IDT_ENTRIES 256 | ||
120 | |||
121 | /* Bottom two bits of selector give the ring privilege level */ | ||
122 | #define SEGMENT_RPL_MASK 0x3 | ||
123 | /* Bit 2 is table indicator (LDT/GDT) */ | ||
124 | #define SEGMENT_TI_MASK 0x4 | ||
125 | |||
126 | /* User mode is privilege level 3 */ | ||
127 | #define USER_RPL 0x3 | ||
128 | /* LDT segment has TI set, GDT has it cleared */ | ||
129 | #define SEGMENT_LDT 0x4 | ||
130 | #define SEGMENT_GDT 0x0 | ||
131 | |||
132 | /* | ||
133 | * Matching rules for certain types of segments. | 111 | * Matching rules for certain types of segments. |
134 | */ | 112 | */ |
135 | 113 | ||
diff --git a/include/asm-x86/segment_64.h b/include/asm-x86/segment_64.h index dce742101348..5cc7deb8b034 100644 --- a/include/asm-x86/segment_64.h +++ b/include/asm-x86/segment_64.h | |||
@@ -33,8 +33,6 @@ | |||
33 | #define GDT_ENTRY_TLS_MIN 12 | 33 | #define GDT_ENTRY_TLS_MIN 12 |
34 | #define GDT_ENTRY_TLS_MAX 14 | 34 | #define GDT_ENTRY_TLS_MAX 14 |
35 | 35 | ||
36 | #define GDT_ENTRY_TLS_ENTRIES 3 | ||
37 | |||
38 | #define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */ | 36 | #define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */ |
39 | #define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3) | 37 | #define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3) |
40 | 38 | ||
@@ -45,20 +43,5 @@ | |||
45 | #define GS_TLS_SEL ((GDT_ENTRY_TLS_MIN+GS_TLS)*8 + 3) | 43 | #define GS_TLS_SEL ((GDT_ENTRY_TLS_MIN+GS_TLS)*8 + 3) |
46 | #define FS_TLS_SEL ((GDT_ENTRY_TLS_MIN+FS_TLS)*8 + 3) | 44 | #define FS_TLS_SEL ((GDT_ENTRY_TLS_MIN+FS_TLS)*8 + 3) |
47 | 45 | ||
48 | #define IDT_ENTRIES 256 | ||
49 | #define GDT_ENTRIES 16 | 46 | #define GDT_ENTRIES 16 |
50 | #define GDT_SIZE (GDT_ENTRIES * 8) | ||
51 | #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) | ||
52 | |||
53 | /* Bottom two bits of selector give the ring privilege level */ | ||
54 | #define SEGMENT_RPL_MASK 0x3 | ||
55 | /* Bit 2 is table indicator (LDT/GDT) */ | ||
56 | #define SEGMENT_TI_MASK 0x4 | ||
57 | |||
58 | /* User mode is privilege level 3 */ | ||
59 | #define USER_RPL 0x3 | ||
60 | /* LDT segment has TI set, GDT has it cleared */ | ||
61 | #define SEGMENT_LDT 0x4 | ||
62 | #define SEGMENT_GDT 0x0 | ||
63 | |||
64 | #endif | 47 | #endif |