aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smpcommon.c
diff options
context:
space:
mode:
authorAlex Nixon <alex.nixon@citrix.com>2008-08-15 17:21:14 +0100
committerIngo Molnar <mingo@elte.hu>2008-08-15 19:16:05 +0200
commitfc0091b3c86396afc8e6c273aff21671cf882ee1 (patch)
tree0f9353c2211972a5123edc1844e5d665e690cbb7 /arch/x86/kernel/smpcommon.c
parent529d0e402eee62b7bfc89ec5b763a9a875bb49fb (diff)
downloadkernel_samsung_smdk4412-fc0091b3c86396afc8e6c273aff21671cf882ee1.zip
kernel_samsung_smdk4412-fc0091b3c86396afc8e6c273aff21671cf882ee1.tar.gz
kernel_samsung_smdk4412-fc0091b3c86396afc8e6c273aff21671cf882ee1.tar.bz2
x86: change init_gdt to update the gdt via write_gdt, rather than a direct write.
By writing directly, a memory access violation can occur whilst hotplugging a CPU if the entry was previously marked read-only. Signed-off-by: Alex Nixon <alex.nixon@citrix.com> Cc: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/smpcommon.c')
-rw-r--r--arch/x86/kernel/smpcommon.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/arch/x86/kernel/smpcommon.c b/arch/x86/kernel/smpcommon.c
index 99941b3..397e309 100644
--- a/arch/x86/kernel/smpcommon.c
+++ b/arch/x86/kernel/smpcommon.c
@@ -8,18 +8,21 @@
DEFINE_PER_CPU(unsigned long, this_cpu_off);
EXPORT_PER_CPU_SYMBOL(this_cpu_off);
-/* Initialize the CPU's GDT. This is either the boot CPU doing itself
- (still using the master per-cpu area), or a CPU doing it for a
- secondary which will soon come up. */
+/*
+ * Initialize the CPU's GDT. This is either the boot CPU doing itself
+ * (still using the master per-cpu area), or a CPU doing it for a
+ * secondary which will soon come up.
+ */
__cpuinit void init_gdt(int cpu)
{
- struct desc_struct *gdt = get_cpu_gdt_table(cpu);
+ struct desc_struct gdt;
- pack_descriptor(&gdt[GDT_ENTRY_PERCPU],
- __per_cpu_offset[cpu], 0xFFFFF,
+ pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF,
0x2 | DESCTYPE_S, 0x8);
+ gdt.s = 1;
- gdt[GDT_ENTRY_PERCPU].s = 1;
+ write_gdt_entry(get_cpu_gdt_table(cpu),
+ GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
per_cpu(cpu_number, cpu) = cpu;