x86/asm/entry/32: Replace RESTORE_RSI_RDI with open-coded 32-bit reads
authorDenys Vlasenko <[email protected]>
Fri, 3 Jul 2015 20:19:02 +0000 (22:19 +0200)
committerIngo Molnar <[email protected]>
Mon, 6 Jul 2015 12:56:50 +0000 (14:56 +0200)
This doesn't change much, but uses shorter 32-bit insns:

        -48 8b 74 24 68         mov    0x68(%rsp),%rsi
        -48 8b 7c 24 70         mov    0x70(%rsp),%rdi
        -48 8b 54 24 60         mov    0x60(%rsp),%rdx
        +8b 54 24 60            mov    0x60(%rsp),%edx
        +8b 74 24 68            mov    0x68(%rsp),%esi
        +8b 7c 24 70            mov    0x70(%rsp),%edi

and does the loads in pt_regs order.

Since these are the only uses of RESTORE_RSI_RDI[_RDX], drop
these macros.

Signed-off-by: Denys Vlasenko <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Drewry <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/entry/calling.h
arch/x86/entry/entry_64_compat.S

index f4e6308c4200bcb7bb2b588aafd2b46d4ab288f9..519207f2ee769fa8b35f53b08c5ced0e5ca8eb0f 100644 (file)
@@ -193,12 +193,6 @@ For 32-bit we have the following conventions - kernel is built with
        .macro RESTORE_C_REGS_EXCEPT_RCX_R11
        RESTORE_C_REGS_HELPER 1,0,0,1,1
        .endm
-       .macro RESTORE_RSI_RDI
-       RESTORE_C_REGS_HELPER 0,0,0,0,0
-       .endm
-       .macro RESTORE_RSI_RDI_RDX
-       RESTORE_C_REGS_HELPER 0,0,0,0,1
-       .endm
 
        .macro REMOVE_PT_GPREGS_FROM_STACK addskip=0
        subq $-(15*8+\addskip), %rsp
index bb187a6a877cc62666afb43421eb7e5e8b6fbbfe..b868cfc7298527a600cd8a695bd03e64ddcdbd97 100644 (file)
@@ -140,7 +140,8 @@ sysexit_from_sys_call:
         */
        andl    $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
        movl    RIP(%rsp), %ecx         /* User %eip */
-       RESTORE_RSI_RDI
+       movl    RSI(%rsp), %esi
+       movl    RDI(%rsp), %edi
        xorl    %edx, %edx              /* Do not leak kernel information */
        xorq    %r8, %r8
        xorq    %r9, %r9
@@ -366,7 +367,9 @@ cstar_dispatch:
 
 sysretl_from_sys_call:
        andl    $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
-       RESTORE_RSI_RDI_RDX
+       movl    RDX(%rsp), %edx
+       movl    RSI(%rsp), %esi
+       movl    RDI(%rsp), %edi
        movl    RIP(%rsp), %ecx
        movl    EFLAGS(%rsp), %r11d
        xorq    %r10, %r10