Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6616a147 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Ingo Molnar
Browse files

x86/boot/32: Fix the end of the stack for idle tasks



The frame at the end of each idle task stack is inconsistent with real
task stacks, which have a stack frame header and a real return address
before the pt_regs area.  This inconsistency can be confusing for stack
unwinders.  It also hides useful information about what asm code was
involved in calling into C.

Fix that by changing the initial code jumps to calls.  Also add infinite
loops after the calls to make it clear that the calls don't return, and
to hang if they do.

Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/2588f34b6fbac4ae6f6f9ead2a78d7f8d58a6341.1474480779.git.jpoimboe@redhat.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4d516f41
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -289,7 +289,8 @@ num_subarch_entries = (. - subarch_entries) / 4
ENTRY(start_cpu0)
ENTRY(start_cpu0)
	movl initial_stack, %ecx
	movl initial_stack, %ecx
	movl %ecx, %esp
	movl %ecx, %esp
	jmp  *(initial_code)
	call *(initial_code)
1:	jmp 1b
ENDPROC(start_cpu0)
ENDPROC(start_cpu0)
#endif
#endif


@@ -470,8 +471,9 @@ ENTRY(startup_32_smp)
	xorl %eax,%eax			# Clear LDT
	xorl %eax,%eax			# Clear LDT
	lldt %ax
	lldt %ax


	pushl $0		# fake return address for unwinder
	call *(initial_code)
	jmp *(initial_code)
1:	jmp 1b
ENDPROC(startup_32_smp)


#include "verify_cpu.S"
#include "verify_cpu.S"