Commit 3d1a3bda authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next

Pull x86 asm cleanups from Ingo Molnar:
 "A handful of entry_64.S cleanups"

* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86_64, entry: Merge paranoidzeroentry_ist into idtentry
  x86_64, entry: Merge most 64-bit asm entry macros
  x86_64, entry: Add missing 'DEFAULT_FRAME 0' entry annotations
parents c84a1e32 577ed45e
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack
* frame that is otherwise undefined after a SYSCALL * frame that is otherwise undefined after a SYSCALL
* - TRACE_IRQ_* - Trace hard interrupt state for lock debugging. * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging.
* - errorentry/paranoidentry/zeroentry - Define exception entry points. * - idtentry - Define exception entry points.
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
...@@ -1203,125 +1203,100 @@ apicinterrupt IRQ_WORK_VECTOR \ ...@@ -1203,125 +1203,100 @@ apicinterrupt IRQ_WORK_VECTOR \
/* /*
* Exception entry points. * Exception entry points.
*/ */
.macro zeroentry sym do_sym #define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8)
ENTRY(\sym)
INTR_FRAME
ASM_CLAC
PARAVIRT_ADJUST_EXCEPTION_FRAME
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
subq $ORIG_RAX-R15, %rsp
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
movq %rsp,%rdi /* pt_regs pointer */
xorl %esi,%esi /* no error code */
call \do_sym
jmp error_exit /* %ebx: no swapgs flag */
CFI_ENDPROC
END(\sym)
.endm
.macro paranoidzeroentry sym do_sym .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1
ENTRY(\sym) ENTRY(\sym)
INTR_FRAME /* Sanity check */
ASM_CLAC .if \shift_ist != -1 && \paranoid == 0
PARAVIRT_ADJUST_EXCEPTION_FRAME .error "using shift_ist requires paranoid=1"
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ .endif
subq $ORIG_RAX-R15, %rsp
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF
movq %rsp,%rdi /* pt_regs pointer */
xorl %esi,%esi /* no error code */
call \do_sym
jmp paranoid_exit /* %ebx: no swapgs flag */
CFI_ENDPROC
END(\sym)
.endm
#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8) .if \has_error_code
.macro paranoidzeroentry_ist sym do_sym ist XCPT_FRAME
ENTRY(\sym) .else
INTR_FRAME INTR_FRAME
ASM_CLAC .endif
PARAVIRT_ADJUST_EXCEPTION_FRAME
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
subq $ORIG_RAX-R15, %rsp
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF_DEBUG
movq %rsp,%rdi /* pt_regs pointer */
xorl %esi,%esi /* no error code */
subq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist)
call \do_sym
addq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist)
jmp paranoid_exit /* %ebx: no swapgs flag */
CFI_ENDPROC
END(\sym)
.endm
.macro errorentry sym do_sym
ENTRY(\sym)
XCPT_FRAME
ASM_CLAC ASM_CLAC
PARAVIRT_ADJUST_EXCEPTION_FRAME PARAVIRT_ADJUST_EXCEPTION_FRAME
.ifeq \has_error_code
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
.endif
subq $ORIG_RAX-R15, %rsp subq $ORIG_RAX-R15, %rsp
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
.if \paranoid
call save_paranoid
.else
call error_entry call error_entry
.endif
DEFAULT_FRAME 0 DEFAULT_FRAME 0
.if \paranoid
.if \shift_ist != -1
TRACE_IRQS_OFF_DEBUG /* reload IDT in case of recursion */
.else
TRACE_IRQS_OFF
.endif
.endif
movq %rsp,%rdi /* pt_regs pointer */ movq %rsp,%rdi /* pt_regs pointer */
.if \has_error_code
movq ORIG_RAX(%rsp),%rsi /* get error code */ movq ORIG_RAX(%rsp),%rsi /* get error code */
movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
.else
xorl %esi,%esi /* no error code */
.endif
.if \shift_ist != -1
subq $EXCEPTION_STKSZ, INIT_TSS_IST(\shift_ist)
.endif
call \do_sym call \do_sym
.if \shift_ist != -1
addq $EXCEPTION_STKSZ, INIT_TSS_IST(\shift_ist)
.endif
.if \paranoid
jmp paranoid_exit /* %ebx: no swapgs flag */
.else
jmp error_exit /* %ebx: no swapgs flag */ jmp error_exit /* %ebx: no swapgs flag */
.endif
CFI_ENDPROC CFI_ENDPROC
END(\sym) END(\sym)
.endm .endm
#ifdef CONFIG_TRACING #ifdef CONFIG_TRACING
.macro trace_errorentry sym do_sym .macro trace_idtentry sym do_sym has_error_code:req
errorentry trace(\sym) trace(\do_sym) idtentry trace(\sym) trace(\do_sym) has_error_code=\has_error_code
errorentry \sym \do_sym idtentry \sym \do_sym has_error_code=\has_error_code
.endm .endm
#else #else
.macro trace_errorentry sym do_sym .macro trace_idtentry sym do_sym has_error_code:req
errorentry \sym \do_sym idtentry \sym \do_sym has_error_code=\has_error_code
.endm .endm
#endif #endif
/* error code is on the stack already */ idtentry divide_error do_divide_error has_error_code=0
.macro paranoiderrorentry sym do_sym idtentry overflow do_overflow has_error_code=0
ENTRY(\sym) idtentry bounds do_bounds has_error_code=0
XCPT_FRAME idtentry invalid_op do_invalid_op has_error_code=0
ASM_CLAC idtentry device_not_available do_device_not_available has_error_code=0
PARAVIRT_ADJUST_EXCEPTION_FRAME idtentry double_fault do_double_fault has_error_code=1 paranoid=1
subq $ORIG_RAX-R15, %rsp idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 idtentry invalid_TSS do_invalid_TSS has_error_code=1
call save_paranoid idtentry segment_not_present do_segment_not_present has_error_code=1
DEFAULT_FRAME 0 idtentry spurious_interrupt_bug do_spurious_interrupt_bug has_error_code=0
TRACE_IRQS_OFF idtentry coprocessor_error do_coprocessor_error has_error_code=0
movq %rsp,%rdi /* pt_regs pointer */ idtentry alignment_check do_alignment_check has_error_code=1
movq ORIG_RAX(%rsp),%rsi /* get error code */ idtentry simd_coprocessor_error do_simd_coprocessor_error has_error_code=0
movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
call \do_sym
jmp paranoid_exit /* %ebx: no swapgs flag */
CFI_ENDPROC
END(\sym)
.endm
zeroentry divide_error do_divide_error
zeroentry overflow do_overflow
zeroentry bounds do_bounds
zeroentry invalid_op do_invalid_op
zeroentry device_not_available do_device_not_available
paranoiderrorentry double_fault do_double_fault
zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
errorentry invalid_TSS do_invalid_TSS
errorentry segment_not_present do_segment_not_present
zeroentry spurious_interrupt_bug do_spurious_interrupt_bug
zeroentry coprocessor_error do_coprocessor_error
errorentry alignment_check do_alignment_check
zeroentry simd_coprocessor_error do_simd_coprocessor_error
/* Reload gs selector with exception handling */ /* Reload gs selector with exception handling */
...@@ -1371,7 +1346,7 @@ ENTRY(do_softirq_own_stack) ...@@ -1371,7 +1346,7 @@ ENTRY(do_softirq_own_stack)
END(do_softirq_own_stack) END(do_softirq_own_stack)
#ifdef CONFIG_XEN #ifdef CONFIG_XEN
zeroentry xen_hypervisor_callback xen_do_hypervisor_callback idtentry xen_hypervisor_callback xen_do_hypervisor_callback has_error_code=0
/* /*
* A note on the "critical region" in our callback handler. * A note on the "critical region" in our callback handler.
...@@ -1482,21 +1457,21 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ ...@@ -1482,21 +1457,21 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
*/ */
.pushsection .kprobes.text, "ax" .pushsection .kprobes.text, "ax"
paranoidzeroentry_ist debug do_debug DEBUG_STACK idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
paranoidzeroentry_ist int3 do_int3 DEBUG_STACK idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
paranoiderrorentry stack_segment do_stack_segment idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1
#ifdef CONFIG_XEN #ifdef CONFIG_XEN
zeroentry xen_debug do_debug idtentry xen_debug do_debug has_error_code=0
zeroentry xen_int3 do_int3 idtentry xen_int3 do_int3 has_error_code=0
errorentry xen_stack_segment do_stack_segment idtentry xen_stack_segment do_stack_segment has_error_code=1
#endif #endif
errorentry general_protection do_general_protection idtentry general_protection do_general_protection has_error_code=1
trace_errorentry page_fault do_page_fault trace_idtentry page_fault do_page_fault has_error_code=1
#ifdef CONFIG_KVM_GUEST #ifdef CONFIG_KVM_GUEST
errorentry async_page_fault do_async_page_fault idtentry async_page_fault do_async_page_fault has_error_code=1
#endif #endif
#ifdef CONFIG_X86_MCE #ifdef CONFIG_X86_MCE
paranoidzeroentry machine_check *machine_check_vector(%rip) idtentry machine_check has_error_code=0 paranoid=1 do_sym=*machine_check_vector(%rip)
#endif #endif
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment