Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] x86-64: Set the stack pointer correctly in init_thread and init_tss

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Andi Kleen and committed by
Linus Torvalds
a0d58c97 1209140c

+8 -2
+1 -1
arch/x86_64/kernel/init_task.c
··· 44 44 * section. Since TSS's are completely CPU-local, we want them 45 45 * on exact cacheline boundaries, to eliminate cacheline ping-pong. 46 46 */ 47 - DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp; 47 + DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp = INIT_TSS; 48 48 49 49 #define ALIGN_TO_4K __attribute__((section(".data.init_task")))
+7 -1
include/asm-x86_64/processor.h
··· 254 254 u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; 255 255 } __attribute__((aligned(16))); 256 256 257 - #define INIT_THREAD {} 257 + #define INIT_THREAD { \ 258 + .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ 259 + } 260 + 261 + #define INIT_TSS { \ 262 + .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ 263 + } 258 264 259 265 #define INIT_MMAP \ 260 266 { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }