lkml.org 
[lkml]   [2017]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 17/17] x86/traps: Use a new on_thread_stack() helper to clean up an assertion
On Wed, Sep 06, 2017 at 02:37:02PM -0700, Andy Lutomirski wrote:
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> ---
> arch/x86/include/asm/processor.h | 17 +++++++++++++++++
> arch/x86/include/asm/thread_info.h | 11 -----------
> arch/x86/kernel/traps.c | 3 +--
> 3 files changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 4c137472f530..b6f8dc11c222 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -534,6 +534,23 @@ static inline unsigned long current_top_of_stack(void)
> #endif
> }
>
> +static inline unsigned long current_stack_pointer(void)
> +{
> + unsigned long sp;
> +#ifdef CONFIG_X86_64
> + asm("mov %%rsp,%0" : "=g" (sp));
> +#else
> + asm("mov %%esp,%0" : "=g" (sp));
> +#endif
> + return sp;
> +}

I know you're just moving the function, but this function could also be
cleaned up by using _ASM_SP and getting rid of the ifdef.

--
Josh

\
 
 \ /
  Last update: 2017-09-12 22:12    [W:1.260 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site