diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2015-03-19 18:17:45 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-24 19:42:37 +0100 |
commit | b3fe8ba320ace38cee6859b4c015d81627254ddb (patch) | |
tree | 5d831988166280490c4593f4505dacfca46e54c4 /arch/x86/include/asm/thread_info.h | |
parent | a76c7f4604937bc781bfc411ef92c59474ddadda (diff) | |
download | op-kernel-dev-b3fe8ba320ace38cee6859b4c015d81627254ddb.zip op-kernel-dev-b3fe8ba320ace38cee6859b4c015d81627254ddb.tar.gz |
x86/asm/entry/64: Change the THREAD_INFO() definition to not depend on KERNEL_STACK_OFFSET
This changes the THREAD_INFO() definition and all its callsites
so that they do not count stack position from
(top of stack - KERNEL_STACK_OFFSET), but from top of stack.
Semi-mysterious expressions THREAD_INFO(%rsp,RIP) - "why RIP??"
are now replaced by more logical THREAD_INFO(%rsp,SIZEOF_PTREGS)
- "calculate thread_info's address using information that
rsp is SIZEOF_PTREGS bytes below top of stack".
While at it, replace "(off)-THREAD_SIZE(reg)" with equivalent
"((off)-THREAD_SIZE)(reg)". The form without parentheses
falsely looks like we invoke THREAD_SIZE() macro.
Improve comment atop THREAD_INFO macro definition.
This patch does not change generated code (verified by objdump).
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1426785469-15125-1-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/thread_info.h')
-rw-r--r-- | arch/x86/include/asm/thread_info.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 0abf7ab..ae9c2f1 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -207,10 +207,12 @@ static inline unsigned long current_stack_pointer(void) _ASM_SUB $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg ; /* - * Same if PER_CPU_VAR(kernel_stack) is, perhaps with some offset, already in - * a certain register (to be used in assembler memory operands). + * ASM operand which evaluates to thread_info address + * if it is known that "reg" is exactly "off" bytes below stack top. + * Example (fetch thread_info->fieldname): + * mov TI_fieldname+THREAD_INFO(reg, off),%eax */ -#define THREAD_INFO(reg, off) KERNEL_STACK_OFFSET+(off)-THREAD_SIZE(reg) +#define THREAD_INFO(reg, off) ((off)-THREAD_SIZE)(reg) #endif |