diff options
author | Zachary Amsden <zach@vmware.com> | 2005-10-30 17:59:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:12 -0500 |
commit | 251e6912df43df54570ed68aade703b329c6cd5b (patch) | |
tree | 28695a0c9a468281613a6b8ef8c79596e2764001 /arch/i386/kernel/cpu/common.c | |
parent | 72e12b76fe48d99d1deb417f177b10a9d99b2e74 (diff) |
[PATCH] x86: add an accessor function for getting the per-CPU gdt
Add an accessor function for getting the per-CPU gdt. Callee must already
have the CPU.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/cpu/common.c')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index a162c0326b4a..74145a33cb0f 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -573,6 +573,7 @@ void __devinit cpu_init(void) | |||
573 | int cpu = smp_processor_id(); | 573 | int cpu = smp_processor_id(); |
574 | struct tss_struct * t = &per_cpu(init_tss, cpu); | 574 | struct tss_struct * t = &per_cpu(init_tss, cpu); |
575 | struct thread_struct *thread = ¤t->thread; | 575 | struct thread_struct *thread = ¤t->thread; |
576 | struct desc_struct *gdt = get_cpu_gdt_table(cpu); | ||
576 | __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); | 577 | __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); |
577 | 578 | ||
578 | if (cpu_test_and_set(cpu, cpu_initialized)) { | 579 | if (cpu_test_and_set(cpu, cpu_initialized)) { |
@@ -594,18 +595,16 @@ void __devinit cpu_init(void) | |||
594 | * Initialize the per-CPU GDT with the boot GDT, | 595 | * Initialize the per-CPU GDT with the boot GDT, |
595 | * and set up the GDT descriptor: | 596 | * and set up the GDT descriptor: |
596 | */ | 597 | */ |
597 | memcpy(&per_cpu(cpu_gdt_table, cpu), cpu_gdt_table, | 598 | memcpy(gdt, cpu_gdt_table, GDT_SIZE); |
598 | GDT_SIZE); | ||
599 | 599 | ||
600 | /* Set up GDT entry for 16bit stack */ | 600 | /* Set up GDT entry for 16bit stack */ |
601 | *(__u64 *)&(per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_ESPFIX_SS]) |= | 601 | *(__u64 *)(&gdt[GDT_ENTRY_ESPFIX_SS]) |= |
602 | ((((__u64)stk16_off) << 16) & 0x000000ffffff0000ULL) | | 602 | ((((__u64)stk16_off) << 16) & 0x000000ffffff0000ULL) | |
603 | ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | | 603 | ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | |
604 | (CPU_16BIT_STACK_SIZE - 1); | 604 | (CPU_16BIT_STACK_SIZE - 1); |
605 | 605 | ||
606 | cpu_gdt_descr[cpu].size = GDT_SIZE - 1; | 606 | cpu_gdt_descr[cpu].size = GDT_SIZE - 1; |
607 | cpu_gdt_descr[cpu].address = | 607 | cpu_gdt_descr[cpu].address = (unsigned long)gdt; |
608 | (unsigned long)&per_cpu(cpu_gdt_table, cpu); | ||
609 | 608 | ||
610 | load_gdt(&cpu_gdt_descr[cpu]); | 609 | load_gdt(&cpu_gdt_descr[cpu]); |
611 | load_idt(&idt_descr); | 610 | load_idt(&idt_descr); |