diff options
author | Ravikiran G Thirumalai <kiran@scalex86.org> | 2006-01-11 16:43:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 22:04:53 -0500 |
commit | c11efdf94d3152443c11334720824bb6c7f6c655 (patch) | |
tree | d4185d8de8b855aca51b6bec730aeab3342e2a0f /include | |
parent | bb33421dde79f9a36d5485c56335ff178ac7d268 (diff) |
[PATCH] x86_64: Align and pad x86_64 GDT on page boundary
This patch is on the same lines as Zachary Amsden's i386 GDT page alignemnt
patch in -mm, but for x86_64.
Patch to align and pad x86_64 GDT on page boundries.
[AK: some minor cleanups and fixed incorrect TLS initialization
in CPU init.]
Signed-off-by: Nippun Goel <nippung@calsoftinc.com>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86_64/desc.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h index 5ce0e34f9a0c..eb7723a46790 100644 --- a/include/asm-x86_64/desc.h +++ b/include/asm-x86_64/desc.h | |||
@@ -25,7 +25,7 @@ struct n_desc_struct { | |||
25 | unsigned int a,b; | 25 | unsigned int a,b; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | extern struct desc_struct cpu_gdt_table[NR_CPUS][GDT_ENTRIES]; | 28 | extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; |
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | GATE_INTERRUPT = 0xE, | 31 | GATE_INTERRUPT = 0xE, |
@@ -79,6 +79,9 @@ extern struct desc_struct default_ldt[]; | |||
79 | extern struct gate_struct idt_table[]; | 79 | extern struct gate_struct idt_table[]; |
80 | extern struct desc_ptr cpu_gdt_descr[]; | 80 | extern struct desc_ptr cpu_gdt_descr[]; |
81 | 81 | ||
82 | /* the cpu gdt accessor */ | ||
83 | #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) | ||
84 | |||
82 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) | 85 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) |
83 | { | 86 | { |
84 | struct gate_struct s; | 87 | struct gate_struct s; |
@@ -144,20 +147,20 @@ static inline void set_tss_desc(unsigned cpu, void *addr) | |||
144 | * -1? seg base+limit should be pointing to the address of the | 147 | * -1? seg base+limit should be pointing to the address of the |
145 | * last valid byte | 148 | * last valid byte |
146 | */ | 149 | */ |
147 | set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_TSS], | 150 | set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_TSS], |
148 | (unsigned long)addr, DESC_TSS, | 151 | (unsigned long)addr, DESC_TSS, |
149 | IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1); | 152 | IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1); |
150 | } | 153 | } |
151 | 154 | ||
152 | static inline void set_ldt_desc(unsigned cpu, void *addr, int size) | 155 | static inline void set_ldt_desc(unsigned cpu, void *addr, int size) |
153 | { | 156 | { |
154 | set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (unsigned long)addr, | 157 | set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_LDT], (unsigned long)addr, |
155 | DESC_LDT, size * 8 - 1); | 158 | DESC_LDT, size * 8 - 1); |
156 | } | 159 | } |
157 | 160 | ||
158 | static inline void set_seg_base(unsigned cpu, int entry, void *base) | 161 | static inline void set_seg_base(unsigned cpu, int entry, void *base) |
159 | { | 162 | { |
160 | struct desc_struct *d = &cpu_gdt_table[cpu][entry]; | 163 | struct desc_struct *d = &cpu_gdt(cpu)[entry]; |
161 | u32 addr = (u32)(u64)base; | 164 | u32 addr = (u32)(u64)base; |
162 | BUG_ON((u64)base >> 32); | 165 | BUG_ON((u64)base >> 32); |
163 | d->base0 = addr & 0xffff; | 166 | d->base0 = addr & 0xffff; |
@@ -199,7 +202,7 @@ static inline void set_seg_base(unsigned cpu, int entry, void *base) | |||
199 | 202 | ||
200 | static inline void load_TLS(struct thread_struct *t, unsigned int cpu) | 203 | static inline void load_TLS(struct thread_struct *t, unsigned int cpu) |
201 | { | 204 | { |
202 | u64 *gdt = (u64 *)(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN); | 205 | u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN); |
203 | gdt[0] = t->tls_array[0]; | 206 | gdt[0] = t->tls_array[0]; |
204 | gdt[1] = t->tls_array[1]; | 207 | gdt[1] = t->tls_array[1]; |
205 | gdt[2] = t->tls_array[2]; | 208 | gdt[2] = t->tls_array[2]; |