lkml.org 
[lkml]   [2018]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V2 03/15] x86/fsgsbase/64: Use FS/GS base helpers in core dump
    Date
    When new FSGSBASE instructions enabled, this read will be
    switched to be faster.

    Based-on-code-from: Andy Lutomirski <luto@kernel.org>
    Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
    Reviewed-by: Andi Kleen <ak@linux.intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@kernel.org>
    ---
    arch/x86/include/asm/elf.h | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
    index 0d157d2..49acefb 100644
    --- a/arch/x86/include/asm/elf.h
    +++ b/arch/x86/include/asm/elf.h
    @@ -10,6 +10,7 @@
    #include <asm/ptrace.h>
    #include <asm/user.h>
    #include <asm/auxvec.h>
    +#include <asm/fsgsbase.h>

    typedef unsigned long elf_greg_t;

    @@ -205,7 +206,6 @@ void set_personality_ia32(bool);

    #define ELF_CORE_COPY_REGS(pr_reg, regs) \
    do { \
    - unsigned long base; \
    unsigned v; \
    (pr_reg)[0] = (regs)->r15; \
    (pr_reg)[1] = (regs)->r14; \
    @@ -228,8 +228,8 @@ do { \
    (pr_reg)[18] = (regs)->flags; \
    (pr_reg)[19] = (regs)->sp; \
    (pr_reg)[20] = (regs)->ss; \
    - rdmsrl(MSR_FS_BASE, base); (pr_reg)[21] = base; \
    - rdmsrl(MSR_KERNEL_GS_BASE, base); (pr_reg)[22] = base; \
    + (pr_reg)[21] = read_fsbase(); \
    + (pr_reg)[22] = read_inactive_gsbase(); \
    asm("movl %%ds,%0" : "=r" (v)); (pr_reg)[23] = v; \
    asm("movl %%es,%0" : "=r" (v)); (pr_reg)[24] = v; \
    asm("movl %%fs,%0" : "=r" (v)); (pr_reg)[25] = v; \
    --
    2.7.4
    \
     
     \ /
      Last update: 2018-05-31 20:00    [W:4.065 / U:0.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site