arch/x86: Enforce CPU stack alignment
When rmodule is loaded CPU stack alignment is only guaranteed to 4kiB. Implementation of cpu_info() requires that each CPU sees its stack aligned to CONFIG_STACK_SIZE. Add one spare CPU for the stack reserve, such that alignment can be enforced runtime. Change-Id: Ie04956c64df0dc7bb156002d3d4f2629f92b340e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/26302 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
committed by
Patrick Georgi
parent
b318be2218
commit
2fbb6773e3
@ -19,9 +19,11 @@
|
||||
.global _stack
|
||||
.global _estack
|
||||
|
||||
/* Stack alignment is not enforced with rmodule loader, reserve one
|
||||
* extra CPU such that alignment can be enforced on entry. */
|
||||
.align CONFIG_STACK_SIZE
|
||||
_stack:
|
||||
.space CONFIG_MAX_CPUS*CONFIG_STACK_SIZE
|
||||
.space (CONFIG_MAX_CPUS+1)*CONFIG_STACK_SIZE
|
||||
_estack:
|
||||
#if IS_ENABLED(CONFIG_COOP_MULTITASKING)
|
||||
.global thread_stacks
|
||||
@ -70,8 +72,9 @@ _start:
|
||||
rep
|
||||
stosl
|
||||
|
||||
/* set new stack */
|
||||
/* Set new stack with enforced alignment. */
|
||||
movl $_estack, %esp
|
||||
andl $(~(CONFIG_STACK_SIZE-1)), %esp
|
||||
|
||||
#if IS_ENABLED(CONFIG_COOP_MULTITASKING)
|
||||
/* Push the thread pointer. */
|
||||
|
Reference in New Issue
Block a user