x86/asm/entry/64: Shrink code in 'paranoid_exit'
authorDenys Vlasenko <[email protected]>
Thu, 26 Feb 2015 22:40:29 +0000 (14:40 -0800)
committerIngo Molnar <[email protected]>
Wed, 4 Mar 2015 21:50:50 +0000 (22:50 +0100)
RESTORE_EXTRA_REGS + RESTORE_C_REGS looks small, but it's
a lot of instructions (fourteen). Let's reuse them.

Signed-off-by: Denys Vlasenko <[email protected]>
[ Cleaned up the labels. ]
Signed-off-by: Andy Lutomirski <[email protected]>
Cc: Alexei Starovoitov <[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: Will Drewry <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/59d71848cee3ec9eb48c0252e602efd6bd560e3c.1424989793.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/entry_64.S

index 695f4d434a847d02b15f38b0503639e8ea963b7d..8fafed9f462d1a941838445e4bc6cb81e10b293c 100644 (file)
@@ -1285,15 +1285,13 @@ ENTRY(paranoid_exit)
        DISABLE_INTERRUPTS(CLBR_NONE)
        TRACE_IRQS_OFF_DEBUG
        testl %ebx,%ebx                         /* swapgs needed? */
-       jnz paranoid_restore
+       jnz paranoid_exit_no_swapgs
        TRACE_IRQS_IRETQ 0
        SWAPGS_UNSAFE_STACK
-       RESTORE_EXTRA_REGS
-       RESTORE_C_REGS
-       REMOVE_PT_GPREGS_FROM_STACK 8
-       INTERRUPT_RETURN
-paranoid_restore:
+       jmp paranoid_exit_restore
+paranoid_exit_no_swapgs:
        TRACE_IRQS_IRETQ_DEBUG 0
+paranoid_exit_restore:
        RESTORE_EXTRA_REGS
        RESTORE_C_REGS
        REMOVE_PT_GPREGS_FROM_STACK 8