diff options
Diffstat (limited to 'arch/i386/kernel/cpu')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 27e00565f5e4..794d593c47eb 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -638,6 +638,18 @@ struct pt_regs * __devinit idle_regs(struct pt_regs *regs) | |||
638 | return regs; | 638 | return regs; |
639 | } | 639 | } |
640 | 640 | ||
641 | /* Current gdt points %fs at the "master" per-cpu area: after this, | ||
642 | * it's on the real one. */ | ||
643 | void switch_to_new_gdt(void) | ||
644 | { | ||
645 | struct Xgt_desc_struct gdt_descr; | ||
646 | |||
647 | gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id()); | ||
648 | gdt_descr.size = GDT_SIZE - 1; | ||
649 | load_gdt(&gdt_descr); | ||
650 | asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory"); | ||
651 | } | ||
652 | |||
641 | /* | 653 | /* |
642 | * cpu_init() initializes state that is per-CPU. Some data is already | 654 | * cpu_init() initializes state that is per-CPU. Some data is already |
643 | * initialized (naturally) in the bootstrap process, such as the GDT | 655 | * initialized (naturally) in the bootstrap process, such as the GDT |
@@ -668,6 +680,7 @@ void __cpuinit cpu_init(void) | |||
668 | } | 680 | } |
669 | 681 | ||
670 | load_idt(&idt_descr); | 682 | load_idt(&idt_descr); |
683 | switch_to_new_gdt(); | ||
671 | 684 | ||
672 | /* | 685 | /* |
673 | * Set up and load the per-CPU TSS and LDT | 686 | * Set up and load the per-CPU TSS and LDT |