diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-05-21 18:07:08 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-05-21 19:22:57 -0400 |
commit | cb5dd2c5eed155919f626684691cf525234ecda1 (patch) | |
tree | c012cb07423ff3373330f46b05e0e8ea8c7fb9a0 | |
parent | 1bd24efc8bd1e644b115cae51048c008bea76de1 (diff) |
x86_64, entry: Merge most 64-bit asm entry macros
I haven't touched the device interrupt code, which is different
enough that it's probably not worth merging, and I haven't done
anything about paranoidzeroentry_ist yet.
This appears to produce an entry_64.o file that differs only in the
debug info line numbers.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/e7a6acfb130471700370e77af9e4b4b6ed46f5ef.1400709717.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/kernel/entry_64.S | 152 |
1 files changed, 64 insertions, 88 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 39372ec11f94..eac9b81edfe1 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,39 +1203,53 @@ apicinterrupt IRQ_WORK_VECTOR \ | |||
1203 | /* | 1203 | /* |
1204 | * Exception entry points. | 1204 | * Exception entry points. |
1205 | */ | 1205 | */ |
1206 | .macro zeroentry sym do_sym | 1206 | .macro idtentry sym do_sym has_error_code:req paranoid=0 |
1207 | ENTRY(\sym) | 1207 | ENTRY(\sym) |
1208 | .if \has_error_code | ||
1209 | XCPT_FRAME | ||
1210 | .else | ||
1208 | INTR_FRAME | 1211 | INTR_FRAME |
1209 | ASM_CLAC | 1212 | .endif |
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 | ||
1221 | END(\sym) | ||
1222 | .endm | ||
1223 | 1213 | ||
1224 | .macro paranoidzeroentry sym do_sym | ||
1225 | ENTRY(\sym) | ||
1226 | INTR_FRAME | ||
1227 | ASM_CLAC | 1214 | ASM_CLAC |
1228 | PARAVIRT_ADJUST_EXCEPTION_FRAME | 1215 | PARAVIRT_ADJUST_EXCEPTION_FRAME |
1229 | pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ | 1216 | |
1217 | .ifeq \has_error_code | ||
1218 | pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ | ||
1219 | .endif | ||
1220 | |||
1230 | subq $ORIG_RAX-R15, %rsp | 1221 | subq $ORIG_RAX-R15, %rsp |
1231 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 | 1222 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 |
1223 | |||
1224 | .if \paranoid | ||
1232 | call save_paranoid | 1225 | call save_paranoid |
1226 | .else | ||
1227 | call error_entry | ||
1228 | .endif | ||
1229 | |||
1233 | DEFAULT_FRAME 0 | 1230 | DEFAULT_FRAME 0 |
1231 | |||
1232 | .if \paranoid | ||
1234 | TRACE_IRQS_OFF | 1233 | TRACE_IRQS_OFF |
1235 | movq %rsp,%rdi /* pt_regs pointer */ | 1234 | .endif |
1236 | xorl %esi,%esi /* no error code */ | 1235 | |
1236 | movq %rsp,%rdi /* pt_regs pointer */ | ||
1237 | |||
1238 | .if \has_error_code | ||
1239 | movq ORIG_RAX(%rsp),%rsi /* get error code */ | ||
1240 | movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ | ||
1241 | .else | ||
1242 | xorl %esi,%esi /* no error code */ | ||
1243 | .endif | ||
1244 | |||
1237 | call \do_sym | 1245 | call \do_sym |
1238 | jmp paranoid_exit /* %ebx: no swapgs flag */ | 1246 | |
1247 | .if \paranoid | ||
1248 | jmp paranoid_exit /* %ebx: no swapgs flag */ | ||
1249 | .else | ||
1250 | jmp error_exit /* %ebx: no swapgs flag */ | ||
1251 | .endif | ||
1252 | |||
1239 | CFI_ENDPROC | 1253 | CFI_ENDPROC |
1240 | END(\sym) | 1254 | END(\sym) |
1241 | .endm | 1255 | .endm |
@@ -1262,68 +1276,30 @@ ENTRY(\sym) | |||
1262 | END(\sym) | 1276 | END(\sym) |
1263 | .endm | 1277 | .endm |
1264 | 1278 | ||
1265 | .macro errorentry sym do_sym | ||
1266 | ENTRY(\sym) | ||
1267 | XCPT_FRAME | ||
1268 | ASM_CLAC | ||
1269 | PARAVIRT_ADJUST_EXCEPTION_FRAME | ||
1270 | subq $ORIG_RAX-R15, %rsp | ||
1271 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 | ||
1272 | call error_entry | ||
1273 | DEFAULT_FRAME 0 | ||
1274 | movq %rsp,%rdi /* pt_regs pointer */ | ||
1275 | movq ORIG_RAX(%rsp),%rsi /* get error code */ | ||
1276 | movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ | ||
1277 | call \do_sym | ||
1278 | jmp error_exit /* %ebx: no swapgs flag */ | ||
1279 | CFI_ENDPROC | ||
1280 | END(\sym) | ||
1281 | .endm | ||
1282 | |||
1283 | #ifdef CONFIG_TRACING | 1279 | #ifdef CONFIG_TRACING |
1284 | .macro trace_errorentry sym do_sym | 1280 | .macro trace_idtentry sym do_sym has_error_code:req |
1285 | errorentry trace(\sym) trace(\do_sym) | 1281 | idtentry trace(\sym) trace(\do_sym) has_error_code=\has_error_code |
1286 | errorentry \sym \do_sym | 1282 | idtentry \sym \do_sym has_error_code=\has_error_code |
1287 | .endm | 1283 | .endm |
1288 | #else | 1284 | #else |
1289 | .macro trace_errorentry sym do_sym | 1285 | .macro trace_idtentry sym do_sym has_error_code:req |
1290 | errorentry \sym \do_sym | 1286 | idtentry \sym \do_sym has_error_code=\has_error_code |
1291 | .endm | 1287 | .endm |
1292 | #endif | 1288 | #endif |
1293 | 1289 | ||
1294 | /* error code is on the stack already */ | 1290 | idtentry divide_error do_divide_error has_error_code=0 |
1295 | .macro paranoiderrorentry sym do_sym | 1291 | idtentry overflow do_overflow has_error_code=0 |
1296 | ENTRY(\sym) | 1292 | idtentry bounds do_bounds has_error_code=0 |
1297 | XCPT_FRAME | 1293 | idtentry invalid_op do_invalid_op has_error_code=0 |
1298 | ASM_CLAC | 1294 | idtentry device_not_available do_device_not_available has_error_code=0 |
1299 | PARAVIRT_ADJUST_EXCEPTION_FRAME | 1295 | idtentry double_fault do_double_fault has_error_code=1 paranoid=1 |
1300 | subq $ORIG_RAX-R15, %rsp | 1296 | idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 |
1301 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 | 1297 | idtentry invalid_TSS do_invalid_TSS has_error_code=1 |
1302 | call save_paranoid | 1298 | idtentry segment_not_present do_segment_not_present has_error_code=1 |
1303 | DEFAULT_FRAME 0 | 1299 | idtentry spurious_interrupt_bug do_spurious_interrupt_bug has_error_code=0 |
1304 | TRACE_IRQS_OFF | 1300 | idtentry coprocessor_error do_coprocessor_error has_error_code=0 |
1305 | movq %rsp,%rdi /* pt_regs pointer */ | 1301 | idtentry alignment_check do_alignment_check has_error_code=1 |
1306 | movq ORIG_RAX(%rsp),%rsi /* get error code */ | 1302 | idtentry simd_coprocessor_error do_simd_coprocessor_error has_error_code=0 |
1307 | movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ | ||
1308 | call \do_sym | ||
1309 | jmp paranoid_exit /* %ebx: no swapgs flag */ | ||
1310 | CFI_ENDPROC | ||
1311 | END(\sym) | ||
1312 | .endm | ||
1313 | |||
1314 | zeroentry divide_error do_divide_error | ||
1315 | zeroentry overflow do_overflow | ||
1316 | zeroentry bounds do_bounds | ||
1317 | zeroentry invalid_op do_invalid_op | ||
1318 | zeroentry device_not_available do_device_not_available | ||
1319 | paranoiderrorentry double_fault do_double_fault | ||
1320 | zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun | ||
1321 | errorentry invalid_TSS do_invalid_TSS | ||
1322 | errorentry segment_not_present do_segment_not_present | ||
1323 | zeroentry spurious_interrupt_bug do_spurious_interrupt_bug | ||
1324 | zeroentry coprocessor_error do_coprocessor_error | ||
1325 | errorentry alignment_check do_alignment_check | ||
1326 | zeroentry simd_coprocessor_error do_simd_coprocessor_error | ||
1327 | 1303 | ||
1328 | 1304 | ||
1329 | /* Reload gs selector with exception handling */ | 1305 | /* Reload gs selector with exception handling */ |
@@ -1373,7 +1349,7 @@ ENTRY(do_softirq_own_stack) | |||
1373 | END(do_softirq_own_stack) | 1349 | END(do_softirq_own_stack) |
1374 | 1350 | ||
1375 | #ifdef CONFIG_XEN | 1351 | #ifdef CONFIG_XEN |
1376 | zeroentry xen_hypervisor_callback xen_do_hypervisor_callback | 1352 | idtentry xen_hypervisor_callback xen_do_hypervisor_callback has_error_code=0 |
1377 | 1353 | ||
1378 | /* | 1354 | /* |
1379 | * A note on the "critical region" in our callback handler. | 1355 | * A note on the "critical region" in our callback handler. |
@@ -1486,19 +1462,19 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ | |||
1486 | 1462 | ||
1487 | paranoidzeroentry_ist debug do_debug DEBUG_STACK | 1463 | paranoidzeroentry_ist debug do_debug DEBUG_STACK |
1488 | paranoidzeroentry_ist int3 do_int3 DEBUG_STACK | 1464 | paranoidzeroentry_ist int3 do_int3 DEBUG_STACK |
1489 | paranoiderrorentry stack_segment do_stack_segment | 1465 | idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 |
1490 | #ifdef CONFIG_XEN | 1466 | #ifdef CONFIG_XEN |
1491 | zeroentry xen_debug do_debug | 1467 | idtentry xen_debug do_debug has_error_code=0 |
1492 | zeroentry xen_int3 do_int3 | 1468 | idtentry xen_int3 do_int3 has_error_code=0 |
1493 | errorentry xen_stack_segment do_stack_segment | 1469 | idtentry xen_stack_segment do_stack_segment has_error_code=1 |
1494 | #endif | 1470 | #endif |
1495 | errorentry general_protection do_general_protection | 1471 | idtentry general_protection do_general_protection has_error_code=1 |
1496 | trace_errorentry page_fault do_page_fault | 1472 | trace_idtentry page_fault do_page_fault has_error_code=1 |
1497 | #ifdef CONFIG_KVM_GUEST | 1473 | #ifdef CONFIG_KVM_GUEST |
1498 | errorentry async_page_fault do_async_page_fault | 1474 | idtentry async_page_fault do_async_page_fault has_error_code=1 |
1499 | #endif | 1475 | #endif |
1500 | #ifdef CONFIG_X86_MCE | 1476 | #ifdef CONFIG_X86_MCE |
1501 | paranoidzeroentry machine_check *machine_check_vector(%rip) | 1477 | idtentry machine_check has_error_code=0 paranoid=1 do_sym=*machine_check_vector(%rip) |
1502 | #endif | 1478 | #endif |
1503 | 1479 | ||
1504 | /* | 1480 | /* |