On 05/18/2015 01:28 PM, H. Peter Anvin wrote:
> 
> OK, that is probably too recent.  The simplest answer I think is just to
> .balign 16 each vector.  This is init space... some extra padding really
> doesn't matter.
> 
> Patch attached (still in compile test).
> 

Corrected.

        -hpa


diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index 5a9856e..f11621f 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -233,7 +233,7 @@
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
-extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5];
+extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][16];
 #ifdef CONFIG_TRACING
 # define trace_early_idt_handlers early_idt_handlers
 #endif
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 02d2572..e5afae9 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -492,7 +492,7 @@ setup_once:
        movl %eax,4(%edi)
        /* interrupt gate, dpl=0, present */
        movl $(0x8E000000 + __KERNEL_CS),2(%edi)
-       addl $9,%eax
+       addl $16,%eax
        addl $8,%edi
        loop 1b
 
@@ -524,6 +524,7 @@ setup_once:
        andl $0,setup_once_ref  /* Once is enough, thanks */
        ret
 
+       .balign 16
 ENTRY(early_idt_handlers)
        # 36(%esp) %eflags
        # 32(%esp) %cs
@@ -531,9 +532,8 @@ ENTRY(early_idt_handlers)
        # 24(%rsp) error code
        i = 0
        .rept NUM_EXCEPTION_VECTORS
-       .if (EXCEPTION_ERRCODE_MASK >> i) & 1
-       ASM_NOP2
-       .else
+       .balign 16
+       .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0
        pushl $0                # Dummy error code, to make stack frame uniform
        .endif
        pushl $i                # 20(%esp) Vector number
@@ -542,8 +542,7 @@ ENTRY(early_idt_handlers)
        .endr
 ENDPROC(early_idt_handlers)
        
-       /* This is global to keep gas from relaxing the jumps */
-ENTRY(early_idt_handler)
+early_idt_handler:
        cld
 
        cmpl $2,(%esp)          # X86_TRAP_NMI
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 43eafc8..2d80a09 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -321,7 +321,8 @@ bad_address:
        jmp bad_address
 
        __INIT
-       .globl early_idt_handlers
+       .balign 16
+ENTRY(early_idt_handlers)
 early_idt_handlers:
        # 104(%rsp) %rflags
        #  96(%rsp) %cs
@@ -329,18 +330,17 @@ early_idt_handlers:
        #  80(%rsp) error code
        i = 0
        .rept NUM_EXCEPTION_VECTORS
-       .if (EXCEPTION_ERRCODE_MASK >> i) & 1
-       ASM_NOP2
-       .else
+       .balign 16
+       .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0
        pushq $0                # Dummy error code, to make stack frame uniform
        .endif
        pushq $i                # 72(%rsp) Vector number
        jmp early_idt_handler
        i = i + 1
        .endr
+ENDPROC(early_idt_handlers)
 
-/* This is global to keep gas from relaxing the jumps */
-ENTRY(early_idt_handler)
+early_idt_handler:
        cld
 
        cmpl $2,(%rsp)          # X86_TRAP_NMI

Reply via email to