From 1d8c80bc05cdd049fa282b00a9e6d041bfc72dff Mon Sep 17 00:00:00 2001 From: "Charles E. Youse" Date: Fri, 20 Sep 2019 18:34:41 -0400 Subject: [PATCH] arch/x86: (Intel64) move STACK_SENTINEL check This function call was erroneously inserted between the instruction that set the Z flag and the instruction that tested the Z flag. The call is moved up a few instructions where it can't junk CPU state. Signed-off-by: Charles E. Youse --- arch/x86/core/intel64/locore.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/core/intel64/locore.S b/arch/x86/core/intel64/locore.S index c2ac88a7ebf..e02337c562f 100644 --- a/arch/x86/core/intel64/locore.S +++ b/arch/x86/core/intel64/locore.S @@ -505,14 +505,14 @@ irq_dispatch: movl %eax, (CONFIG_LOAPIC_BASE_ADDRESS + LOAPIC_EOI) #endif +#ifdef CONFIG_STACK_SENTINEL + call z_check_stack_sentinel +#endif movq $_kernel, %rsi cli addq $CONFIG_ISR_SUBSTACK_SIZE, %gs:__x86_tss64_t_ist1_OFFSET decl _kernel_offset_to_nested(%rsi) - /* not nested, exit via __resume (might change threads) */ -#ifdef CONFIG_STACK_SENTINEL - call z_check_stack_sentinel -#endif + /* if not nested, exit via __resume (might change threads) */ jz __resume irq_exit_nested: