aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2025-03-03 16:54:24 +0100
committerIngo Molnar <mingo@kernel.org>2025-03-04 20:28:58 +0100
commitd4432fb5b8798a7663974bed277a8a6e330a50d8 (patch)
tree30d51087d2a98000197961734a6a81413b5c61ac
parentx86/irq/32: Add missing clobber to inline asm (diff)
downloadwireguard-linux-d4432fb5b8798a7663974bed277a8a6e330a50d8.tar.xz
wireguard-linux-d4432fb5b8798a7663974bed277a8a6e330a50d8.zip
x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
Make code more readable by using the 'current_stack_pointer' global variable. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250303155446.112769-4-ubizjak@gmail.com
-rw-r--r--arch/x86/kernel/irq_32.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index eab458009f97..8c7babbcf6b7 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
- long sp;
-
- __asm__ __volatile__("andl %%esp,%0" :
- "=r" (sp) : "0" (THREAD_SIZE - 1));
+ unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
return sp < (sizeof(struct thread_info) + STACK_WARN);
}