aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 18:41:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 18:41:07 -0400
commit3d1a3bda65d2f48fead6f0727f2f392c15206852 (patch)
treee8856da7d596333734710b1299411eff9bac3271
parentc84a1e32ee58fc1cc9d3fd42619b917cce67e30a (diff)
parent577ed45ec56e9c43269df1c4a05c59ed19ea8e6a (diff)
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
-rw-r--r--arch/x86/kernel/entry_64.S185
1 files changed, 80 insertions, 105 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1e96c3628bf2..be846d2468f7 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -36,7 +36,7 @@
36 * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack 36 * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack
37 * frame that is otherwise undefined after a SYSCALL 37 * frame that is otherwise undefined after a SYSCALL
38 * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging. 38 * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging.
39 * - errorentry/paranoidentry/zeroentry - Define exception entry points. 39 * - idtentry - Define exception entry points.
40 */ 40 */
41 41
42#include <linux/linkage.h> 42#include <linux/linkage.h>
@@ -1203,125 +1203,100 @@ apicinterrupt IRQ_WORK_VECTOR \
1203/* 1203/*
1204 * Exception entry points. 1204 * Exception entry points.
1205 */ 1205 */
1206.macro zeroentry sym do_sym 1206#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8)
1207ENTRY(\sym)
1208 INTR_FRAME
1209 ASM_CLAC
1210 PARAVIRT_ADJUST_EXCEPTION_FRAME
1211 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1212 subq $ORIG_RAX-R15, %rsp
1213 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
1214 call error_entry
1215 DEFAULT_FRAME 0
1216 movq %rsp,%rdi /* pt_regs pointer */
1217 xorl %esi,%esi /* no error code */
1218 call \do_sym
1219 jmp error_exit /* %ebx: no swapgs flag */
1220 CFI_ENDPROC
1221END(\sym)
1222.endm
1223 1207
1224.macro paranoidzeroentry sym do_sym 1208.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1
1225ENTRY(\sym) 1209ENTRY(\sym)
1226 INTR_FRAME 1210 /* Sanity check */
1227 ASM_CLAC 1211 .if \shift_ist != -1 && \paranoid == 0
1228 PARAVIRT_ADJUST_EXCEPTION_FRAME 1212 .error "using shift_ist requires paranoid=1"
1229 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 1213 .endif
1230 subq $ORIG_RAX-R15, %rsp
1231 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
1232 call save_paranoid
1233 TRACE_IRQS_OFF
1234 movq %rsp,%rdi /* pt_regs pointer */
1235 xorl %esi,%esi /* no error code */
1236 call \do_sym
1237 jmp paranoid_exit /* %ebx: no swapgs flag */
1238 CFI_ENDPROC
1239END(\sym)
1240.endm
1241 1214
1242#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8) 1215 .if \has_error_code
1243.macro paranoidzeroentry_ist sym do_sym ist 1216 XCPT_FRAME
1244ENTRY(\sym) 1217 .else
1245 INTR_FRAME 1218 INTR_FRAME
1246 ASM_CLAC 1219 .endif
1247 PARAVIRT_ADJUST_EXCEPTION_FRAME
1248 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1249 subq $ORIG_RAX-R15, %rsp
1250 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
1251 call save_paranoid
1252 TRACE_IRQS_OFF_DEBUG
1253 movq %rsp,%rdi /* pt_regs pointer */
1254 xorl %esi,%esi /* no error code */
1255 subq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist)
1256 call \do_sym
1257 addq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist)
1258 jmp paranoid_exit /* %ebx: no swapgs flag */
1259 CFI_ENDPROC
1260END(\sym)
1261.endm
1262 1220
1263.macro errorentry sym do_sym
1264ENTRY(\sym)
1265 XCPT_FRAME
1266 ASM_CLAC 1221 ASM_CLAC
1267 PARAVIRT_ADJUST_EXCEPTION_FRAME 1222 PARAVIRT_ADJUST_EXCEPTION_FRAME
1223
1224 .ifeq \has_error_code
1225 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1226 .endif
1227
1268 subq $ORIG_RAX-R15, %rsp 1228 subq $ORIG_RAX-R15, %rsp
1269 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 1229 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
1230
1231 .if \paranoid
1232 call save_paranoid
1233 .else
1270 call error_entry 1234 call error_entry
1235 .endif
1236
1271 DEFAULT_FRAME 0 1237 DEFAULT_FRAME 0
1238
1239 .if \paranoid
1240 .if \shift_ist != -1
1241 TRACE_IRQS_OFF_DEBUG /* reload IDT in case of recursion */
1242 .else
1243 TRACE_IRQS_OFF
1244 .endif
1245 .endif
1246
1272 movq %rsp,%rdi /* pt_regs pointer */ 1247 movq %rsp,%rdi /* pt_regs pointer */
1248
1249 .if \has_error_code
1273 movq ORIG_RAX(%rsp),%rsi /* get error code */ 1250 movq ORIG_RAX(%rsp),%rsi /* get error code */
1274 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ 1251 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
1252 .else
1253 xorl %esi,%esi /* no error code */
1254 .endif
1255
1256 .if \shift_ist != -1
1257 subq $EXCEPTION_STKSZ, INIT_TSS_IST(\shift_ist)
1258 .endif
1259
1275 call \do_sym 1260 call \do_sym
1261
1262 .if \shift_ist != -1
1263 addq $EXCEPTION_STKSZ, INIT_TSS_IST(\shift_ist)
1264 .endif
1265
1266 .if \paranoid
1267 jmp paranoid_exit /* %ebx: no swapgs flag */
1268 .else
1276 jmp error_exit /* %ebx: no swapgs flag */ 1269 jmp error_exit /* %ebx: no swapgs flag */
1270 .endif
1271
1277 CFI_ENDPROC 1272 CFI_ENDPROC
1278END(\sym) 1273END(\sym)
1279.endm 1274.endm
1280 1275
1281#ifdef CONFIG_TRACING 1276#ifdef CONFIG_TRACING
1282.macro trace_errorentry sym do_sym 1277.macro trace_idtentry sym do_sym has_error_code:req
1283errorentry trace(\sym) trace(\do_sym) 1278idtentry trace(\sym) trace(\do_sym) has_error_code=\has_error_code
1284errorentry \sym \do_sym 1279idtentry \sym \do_sym has_error_code=\has_error_code
1285.endm 1280.endm
1286#else 1281#else
1287.macro trace_errorentry sym do_sym 1282.macro trace_idtentry sym do_sym has_error_code:req
1288errorentry \sym \do_sym 1283idtentry \sym \do_sym has_error_code=\has_error_code
1289.endm 1284.endm
1290#endif 1285#endif
1291 1286
1292 /* error code is on the stack already */ 1287idtentry divide_error do_divide_error has_error_code=0
1293.macro paranoiderrorentry sym do_sym 1288idtentry overflow do_overflow has_error_code=0
1294ENTRY(\sym) 1289idtentry bounds do_bounds has_error_code=0
1295 XCPT_FRAME 1290idtentry invalid_op do_invalid_op has_error_code=0
1296 ASM_CLAC 1291idtentry device_not_available do_device_not_available has_error_code=0
1297 PARAVIRT_ADJUST_EXCEPTION_FRAME 1292idtentry double_fault do_double_fault has_error_code=1 paranoid=1
1298 subq $ORIG_RAX-R15, %rsp 1293idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0
1299 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 1294idtentry invalid_TSS do_invalid_TSS has_error_code=1
1300 call save_paranoid 1295idtentry segment_not_present do_segment_not_present has_error_code=1
1301 DEFAULT_FRAME 0 1296idtentry spurious_interrupt_bug do_spurious_interrupt_bug has_error_code=0
1302 TRACE_IRQS_OFF 1297idtentry coprocessor_error do_coprocessor_error has_error_code=0
1303 movq %rsp,%rdi /* pt_regs pointer */ 1298idtentry alignment_check do_alignment_check has_error_code=1
1304 movq ORIG_RAX(%rsp),%rsi /* get error code */ 1299idtentry simd_coprocessor_error do_simd_coprocessor_error has_error_code=0
1305 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
1306 call \do_sym
1307 jmp paranoid_exit /* %ebx: no swapgs flag */
1308 CFI_ENDPROC
1309END(\sym)
1310.endm
1311
1312zeroentry divide_error do_divide_error
1313zeroentry overflow do_overflow
1314zeroentry bounds do_bounds
1315zeroentry invalid_op do_invalid_op
1316zeroentry device_not_available do_device_not_available
1317paranoiderrorentry double_fault do_double_fault
1318zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
1319errorentry invalid_TSS do_invalid_TSS
1320errorentry segment_not_present do_segment_not_present
1321zeroentry spurious_interrupt_bug do_spurious_interrupt_bug
1322zeroentry coprocessor_error do_coprocessor_error
1323errorentry alignment_check do_alignment_check
1324zeroentry simd_coprocessor_error do_simd_coprocessor_error
1325 1300
1326 1301
1327 /* Reload gs selector with exception handling */ 1302 /* Reload gs selector with exception handling */
@@ -1371,7 +1346,7 @@ ENTRY(do_softirq_own_stack)
1371END(do_softirq_own_stack) 1346END(do_softirq_own_stack)
1372 1347
1373#ifdef CONFIG_XEN 1348#ifdef CONFIG_XEN
1374zeroentry xen_hypervisor_callback xen_do_hypervisor_callback 1349idtentry xen_hypervisor_callback xen_do_hypervisor_callback has_error_code=0
1375 1350
1376/* 1351/*
1377 * A note on the "critical region" in our callback handler. 1352 * A note on the "critical region" in our callback handler.
@@ -1482,21 +1457,21 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1482 */ 1457 */
1483 .pushsection .kprobes.text, "ax" 1458 .pushsection .kprobes.text, "ax"
1484 1459
1485paranoidzeroentry_ist debug do_debug DEBUG_STACK 1460idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
1486paranoidzeroentry_ist int3 do_int3 DEBUG_STACK 1461idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
1487paranoiderrorentry stack_segment do_stack_segment 1462idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1
1488#ifdef CONFIG_XEN 1463#ifdef CONFIG_XEN
1489zeroentry xen_debug do_debug 1464idtentry xen_debug do_debug has_error_code=0
1490zeroentry xen_int3 do_int3 1465idtentry xen_int3 do_int3 has_error_code=0
1491errorentry xen_stack_segment do_stack_segment 1466idtentry xen_stack_segment do_stack_segment has_error_code=1
1492#endif 1467#endif
1493errorentry general_protection do_general_protection 1468idtentry general_protection do_general_protection has_error_code=1
1494trace_errorentry page_fault do_page_fault 1469trace_idtentry page_fault do_page_fault has_error_code=1
1495#ifdef CONFIG_KVM_GUEST 1470#ifdef CONFIG_KVM_GUEST
1496errorentry async_page_fault do_async_page_fault 1471idtentry async_page_fault do_async_page_fault has_error_code=1
1497#endif 1472#endif
1498#ifdef CONFIG_X86_MCE 1473#ifdef CONFIG_X86_MCE
1499paranoidzeroentry machine_check *machine_check_vector(%rip) 1474idtentry machine_check has_error_code=0 paranoid=1 do_sym=*machine_check_vector(%rip)
1500#endif 1475#endif
1501 1476
1502 /* 1477 /*