]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
x86/entry: Add task_top_of_stack() to find the top of a task's stack
authorAndy Lutomirski <luto@kernel.org>
Thu, 2 Nov 2017 07:59:11 +0000 (00:59 -0700)
committerIngo Molnar <mingo@kernel.org>
Thu, 2 Nov 2017 10:04:44 +0000 (11:04 +0100)
This will let us get rid of a few places that hardcode accesses to
thread.sp0.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/b49b3f95a8ff858c40c9b0f5b32be0355324327d.1509609304.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/processor.h

index 064b84722166ad9c59dc15e6ab20a2bc80a243ee..ad59cec14239476c8b0342be90318cfb9f76507b 100644 (file)
@@ -795,6 +795,8 @@ static inline void spin_lock_prefetch(const void *x)
 #define TOP_OF_INIT_STACK ((unsigned long)&init_stack + sizeof(init_stack) - \
                           TOP_OF_KERNEL_STACK_PADDING)
 
+#define task_top_of_stack(task) ((unsigned long)(task_pt_regs(task) + 1))
+
 #ifdef CONFIG_X86_32
 /*
  * User space process size: 3GB (default).