Tidy up TEST insns width to use shorter insn form,
Use logically correct JZ mnemonic instead of JE (this doesn't change code).
Replace several BT insns with equivalent, but shorter TEST insns.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Linus Torvalds <torva...@linux-foundation.org>
CC: Steven Rostedt <rost...@goodmis.org>
CC: Ingo Molnar <mi...@kernel.org>
CC: Borislav Petkov <b...@alien8.de>
CC: "H. Peter Anvin" <h...@zytor.com>
CC: Andy Lutomirski <l...@amacapital.net>
CC: Oleg Nesterov <o...@redhat.com>
CC: Frederic Weisbecker <fweis...@gmail.com>
CC: Alexei Starovoitov <a...@plumgrid.com>
CC: Will Drewry <w...@chromium.org>
CC: Kees Cook <keesc...@chromium.org>
CC: x...@kernel.org
CC: linux-kernel@vger.kernel.org
---
 arch/x86/kernel/entry_64.S | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 356266c..cc166ab 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -67,8 +67,8 @@ ENDPROC(native_usergs_sysret64)
 
 .macro TRACE_IRQS_IRETQ
 #ifdef CONFIG_TRACE_IRQFLAGS
-       bt   $9,EFLAGS(%rsp)    /* interrupts off? */
-       jnc  1f
+       testb   $2, EFLAGS+1(%rsp)      /* interrupts off? */
+       jz      1f
        TRACE_IRQS_ON
 1:
 #endif
@@ -100,8 +100,8 @@ ENDPROC(native_usergs_sysret64)
 .endm
 
 .macro TRACE_IRQS_IRETQ_DEBUG
-       bt   $9,EFLAGS(%rsp)    /* interrupts off? */
-       jnc  1f
+       testb   $2, EFLAGS+1(%rsp)      /* interrupts off? */
+       jz      1f
        TRACE_IRQS_ON_DEBUG
 1:
 .endm
@@ -513,8 +513,8 @@ ENTRY(ret_from_fork)
 
        RESTORE_EXTRA_REGS
 
-       testl $3,CS(%rsp)                       # from kernel_thread?
-       jz   1f
+       testb   $3, CS(%rsp)                    # from kernel_thread?
+       jz      1f
 
        /*
         * By the time we get here, we have no idea whether our pt_regs,
@@ -598,8 +598,8 @@ END(interrupt)
 
        leaq -RBP(%rsp),%rdi    /* arg1 for \func (pointer to pt_regs) */
 
-       testl $3, CS-RBP(%rsp)
-       je 1f
+       testb   $3, CS-RBP(%rsp)
+       jz      1f
        SWAPGS
 1:
        /*
@@ -653,8 +653,8 @@ ret_from_intr:
        CFI_DEF_CFA_REGISTER    rsp
        CFI_ADJUST_CFA_OFFSET   RBP
 
-       testl $3,CS(%rsp)
-       je retint_kernel
+       testb   $3, CS(%rsp)
+       jz      retint_kernel
        /* Interrupt came from user space */
 
        GET_THREAD_INFO(%rcx)
@@ -739,8 +739,8 @@ retint_kernel:
 #ifdef CONFIG_PREEMPT
        /* Interrupts are off */
        /* Check if we need preemption */
-       bt      $9,EFLAGS(%rsp) /* interrupts were off? */
-       jnc     1f
+       testb   $2,EFLAGS+1(%rsp)       /* interrupts were off? */
+       jz      1f
 0:     cmpl    $0,PER_CPU_VAR(__preempt_count)
        jnz     1f
        call    preempt_schedule_irq
@@ -950,8 +950,8 @@ ENTRY(\sym)
        .if \paranoid
        .if \paranoid == 1
        CFI_REMEMBER_STATE
-       testl $3, CS(%rsp)              /* If coming from userspace, switch */
-       jnz 1f                          /* stacks. */
+       testb   $3, CS(%rsp)            /* If coming from userspace, switch */
+       jnz     1f                      /* stacks. */
        .endif
        call paranoid_entry
        .else
@@ -1291,8 +1291,8 @@ ENTRY(error_entry)
        SAVE_C_REGS 8
        SAVE_EXTRA_REGS 8
        xorl %ebx,%ebx
-       testl $3,CS+8(%rsp)
-       je error_kernelspace
+       testb $3,CS+8(%rsp)
+       jz error_kernelspace
 error_swapgs:
        SWAPGS
 error_sti:
@@ -1343,7 +1343,7 @@ ENTRY(error_exit)
        TRACE_IRQS_OFF
        GET_THREAD_INFO(%rcx)
        testl %eax,%eax
-       jne retint_kernel
+       jnz retint_kernel
        LOCKDEP_SYS_EXIT_IRQ
        movl TI_flags(%rcx),%edx
        movl $_TIF_WORK_MASK,%edi
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to