diff options
author | Alexander van Heukelum <heukelum@fastmail.fm> | 2008-09-30 12:41:36 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-13 04:33:20 -0400 |
commit | e407d62088b7f61f38e1086062650c75a4f2757a (patch) | |
tree | b0b5b666361c305f93bdf0e439d69acf7ee2f0e0 /arch | |
parent | ae82157b3d8bb4902f76b56c7450a945288786ac (diff) |
x86, traps: introduce dotraplinkage
Mark the exception handlers with "dotraplinkage" to hide the
calling convention differences between i386 and x86_64.
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 2 | ||||
-rw-r--r-- | arch/x86/kernel/traps_32.c | 28 | ||||
-rw-r--r-- | arch/x86/kernel/traps_64.c | 31 |
3 files changed, 36 insertions, 25 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 977c8ea66028..1db6ce4314e1 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -1243,7 +1243,7 @@ ENTRY(simd_coprocessor_error) | |||
1243 | END(simd_coprocessor_error) | 1243 | END(simd_coprocessor_error) |
1244 | 1244 | ||
1245 | ENTRY(device_not_available) | 1245 | ENTRY(device_not_available) |
1246 | zeroentry math_state_restore | 1246 | zeroentry do_device_not_available |
1247 | END(device_not_available) | 1247 | END(device_not_available) |
1248 | 1248 | ||
1249 | /* runs on exception stack */ | 1249 | /* runs on exception stack */ |
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 0206c915748c..7eb1203c909d 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -190,7 +190,7 @@ vm86_trap: | |||
190 | } | 190 | } |
191 | 191 | ||
192 | #define DO_ERROR(trapnr, signr, str, name) \ | 192 | #define DO_ERROR(trapnr, signr, str, name) \ |
193 | void do_##name(struct pt_regs *regs, long error_code) \ | 193 | dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ |
194 | { \ | 194 | { \ |
195 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ | 195 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ |
196 | == NOTIFY_STOP) \ | 196 | == NOTIFY_STOP) \ |
@@ -200,7 +200,7 @@ void do_##name(struct pt_regs *regs, long error_code) \ | |||
200 | } | 200 | } |
201 | 201 | ||
202 | #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ | 202 | #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ |
203 | void do_##name(struct pt_regs *regs, long error_code) \ | 203 | dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ |
204 | { \ | 204 | { \ |
205 | siginfo_t info; \ | 205 | siginfo_t info; \ |
206 | info.si_signo = signr; \ | 206 | info.si_signo = signr; \ |
@@ -224,7 +224,7 @@ DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | |||
224 | DO_ERROR(12, SIGBUS, "stack segment", stack_segment) | 224 | DO_ERROR(12, SIGBUS, "stack segment", stack_segment) |
225 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) | 225 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) |
226 | 226 | ||
227 | void __kprobes | 227 | dotraplinkage void __kprobes |
228 | do_general_protection(struct pt_regs *regs, long error_code) | 228 | do_general_protection(struct pt_regs *regs, long error_code) |
229 | { | 229 | { |
230 | struct task_struct *tsk; | 230 | struct task_struct *tsk; |
@@ -428,7 +428,8 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs) | |||
428 | reassert_nmi(); | 428 | reassert_nmi(); |
429 | } | 429 | } |
430 | 430 | ||
431 | notrace __kprobes void do_nmi(struct pt_regs *regs, long error_code) | 431 | dotraplinkage notrace __kprobes void |
432 | do_nmi(struct pt_regs *regs, long error_code) | ||
432 | { | 433 | { |
433 | int cpu; | 434 | int cpu; |
434 | 435 | ||
@@ -456,7 +457,7 @@ void restart_nmi(void) | |||
456 | acpi_nmi_enable(); | 457 | acpi_nmi_enable(); |
457 | } | 458 | } |
458 | 459 | ||
459 | void __kprobes do_int3(struct pt_regs *regs, long error_code) | 460 | dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) |
460 | { | 461 | { |
461 | #ifdef CONFIG_KPROBES | 462 | #ifdef CONFIG_KPROBES |
462 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | 463 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) |
@@ -494,7 +495,7 @@ void __kprobes do_int3(struct pt_regs *regs, long error_code) | |||
494 | * find every occurrence of the TF bit that could be saved away even | 495 | * find every occurrence of the TF bit that could be saved away even |
495 | * by user code) | 496 | * by user code) |
496 | */ | 497 | */ |
497 | void __kprobes do_debug(struct pt_regs *regs, long error_code) | 498 | dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code) |
498 | { | 499 | { |
499 | struct task_struct *tsk = current; | 500 | struct task_struct *tsk = current; |
500 | unsigned int condition; | 501 | unsigned int condition; |
@@ -627,7 +628,7 @@ void math_error(void __user *ip) | |||
627 | force_sig_info(SIGFPE, &info, task); | 628 | force_sig_info(SIGFPE, &info, task); |
628 | } | 629 | } |
629 | 630 | ||
630 | void do_coprocessor_error(struct pt_regs *regs, long error_code) | 631 | dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) |
631 | { | 632 | { |
632 | conditional_sti(regs); | 633 | conditional_sti(regs); |
633 | ignore_fpu_irq = 1; | 634 | ignore_fpu_irq = 1; |
@@ -682,7 +683,8 @@ static void simd_math_error(void __user *ip) | |||
682 | force_sig_info(SIGFPE, &info, task); | 683 | force_sig_info(SIGFPE, &info, task); |
683 | } | 684 | } |
684 | 685 | ||
685 | void do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | 686 | dotraplinkage void |
687 | do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | ||
686 | { | 688 | { |
687 | conditional_sti(regs); | 689 | conditional_sti(regs); |
688 | 690 | ||
@@ -706,7 +708,8 @@ void do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | |||
706 | force_sig(SIGSEGV, current); | 708 | force_sig(SIGSEGV, current); |
707 | } | 709 | } |
708 | 710 | ||
709 | void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code) | 711 | dotraplinkage void |
712 | do_spurious_interrupt_bug(struct pt_regs *regs, long error_code) | ||
710 | { | 713 | { |
711 | conditional_sti(regs); | 714 | conditional_sti(regs); |
712 | #if 0 | 715 | #if 0 |
@@ -784,7 +787,8 @@ asmlinkage void math_emulate(long arg) | |||
784 | 787 | ||
785 | #endif /* CONFIG_MATH_EMULATION */ | 788 | #endif /* CONFIG_MATH_EMULATION */ |
786 | 789 | ||
787 | void __kprobes do_device_not_available(struct pt_regs *regs, long error) | 790 | dotraplinkage void __kprobes |
791 | do_device_not_available(struct pt_regs *regs, long error) | ||
788 | { | 792 | { |
789 | if (read_cr0() & X86_CR0_EM) { | 793 | if (read_cr0() & X86_CR0_EM) { |
790 | conditional_sti(regs); | 794 | conditional_sti(regs); |
@@ -796,14 +800,14 @@ void __kprobes do_device_not_available(struct pt_regs *regs, long error) | |||
796 | } | 800 | } |
797 | 801 | ||
798 | #ifdef CONFIG_X86_MCE | 802 | #ifdef CONFIG_X86_MCE |
799 | void __kprobes do_machine_check(struct pt_regs *regs, long error) | 803 | dotraplinkage void __kprobes do_machine_check(struct pt_regs *regs, long error) |
800 | { | 804 | { |
801 | conditional_sti(regs); | 805 | conditional_sti(regs); |
802 | machine_check_vector(regs, error); | 806 | machine_check_vector(regs, error); |
803 | } | 807 | } |
804 | #endif | 808 | #endif |
805 | 809 | ||
806 | void do_iret_error(struct pt_regs *regs, long error_code) | 810 | dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) |
807 | { | 811 | { |
808 | siginfo_t info; | 812 | siginfo_t info; |
809 | local_irq_enable(); | 813 | local_irq_enable(); |
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index b295ebf0cb3f..be73323ca952 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
@@ -125,7 +125,7 @@ kernel_trap: | |||
125 | } | 125 | } |
126 | 126 | ||
127 | #define DO_ERROR(trapnr, signr, str, name) \ | 127 | #define DO_ERROR(trapnr, signr, str, name) \ |
128 | asmlinkage void do_##name(struct pt_regs *regs, long error_code) \ | 128 | dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ |
129 | { \ | 129 | { \ |
130 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ | 130 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ |
131 | == NOTIFY_STOP) \ | 131 | == NOTIFY_STOP) \ |
@@ -135,7 +135,7 @@ asmlinkage void do_##name(struct pt_regs *regs, long error_code) \ | |||
135 | } | 135 | } |
136 | 136 | ||
137 | #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ | 137 | #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ |
138 | asmlinkage void do_##name(struct pt_regs *regs, long error_code) \ | 138 | dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ |
139 | { \ | 139 | { \ |
140 | siginfo_t info; \ | 140 | siginfo_t info; \ |
141 | info.si_signo = signr; \ | 141 | info.si_signo = signr; \ |
@@ -159,7 +159,7 @@ DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | |||
159 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) | 159 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) |
160 | 160 | ||
161 | /* Runs on IST stack */ | 161 | /* Runs on IST stack */ |
162 | asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code) | 162 | dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) |
163 | { | 163 | { |
164 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, | 164 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, |
165 | 12, SIGBUS) == NOTIFY_STOP) | 165 | 12, SIGBUS) == NOTIFY_STOP) |
@@ -169,7 +169,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code) | |||
169 | preempt_conditional_cli(regs); | 169 | preempt_conditional_cli(regs); |
170 | } | 170 | } |
171 | 171 | ||
172 | asmlinkage void do_double_fault(struct pt_regs *regs, long error_code) | 172 | dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) |
173 | { | 173 | { |
174 | static const char str[] = "double fault"; | 174 | static const char str[] = "double fault"; |
175 | struct task_struct *tsk = current; | 175 | struct task_struct *tsk = current; |
@@ -186,7 +186,7 @@ asmlinkage void do_double_fault(struct pt_regs *regs, long error_code) | |||
186 | die(str, regs, error_code); | 186 | die(str, regs, error_code); |
187 | } | 187 | } |
188 | 188 | ||
189 | asmlinkage void __kprobes | 189 | dotraplinkage void __kprobes |
190 | do_general_protection(struct pt_regs *regs, long error_code) | 190 | do_general_protection(struct pt_regs *regs, long error_code) |
191 | { | 191 | { |
192 | struct task_struct *tsk; | 192 | struct task_struct *tsk; |
@@ -317,7 +317,7 @@ asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs) | |||
317 | io_check_error(reason, regs); | 317 | io_check_error(reason, regs); |
318 | } | 318 | } |
319 | 319 | ||
320 | asmlinkage notrace __kprobes void | 320 | dotraplinkage notrace __kprobes void |
321 | do_nmi(struct pt_regs *regs, long error_code) | 321 | do_nmi(struct pt_regs *regs, long error_code) |
322 | { | 322 | { |
323 | nmi_enter(); | 323 | nmi_enter(); |
@@ -343,7 +343,7 @@ void restart_nmi(void) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | /* runs on IST stack. */ | 345 | /* runs on IST stack. */ |
346 | asmlinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) | 346 | dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) |
347 | { | 347 | { |
348 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | 348 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) |
349 | == NOTIFY_STOP) | 349 | == NOTIFY_STOP) |
@@ -376,8 +376,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) | |||
376 | } | 376 | } |
377 | 377 | ||
378 | /* runs on IST stack. */ | 378 | /* runs on IST stack. */ |
379 | asmlinkage void __kprobes do_debug(struct pt_regs *regs, | 379 | dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code) |
380 | unsigned long error_code) | ||
381 | { | 380 | { |
382 | struct task_struct *tsk = current; | 381 | struct task_struct *tsk = current; |
383 | unsigned long condition; | 382 | unsigned long condition; |
@@ -510,7 +509,7 @@ void math_error(void __user *ip) | |||
510 | force_sig_info(SIGFPE, &info, task); | 509 | force_sig_info(SIGFPE, &info, task); |
511 | } | 510 | } |
512 | 511 | ||
513 | asmlinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) | 512 | dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) |
514 | { | 513 | { |
515 | conditional_sti(regs); | 514 | conditional_sti(regs); |
516 | if (!user_mode(regs) && | 515 | if (!user_mode(regs) && |
@@ -572,7 +571,8 @@ static void simd_math_error(void __user *ip) | |||
572 | force_sig_info(SIGFPE, &info, task); | 571 | force_sig_info(SIGFPE, &info, task); |
573 | } | 572 | } |
574 | 573 | ||
575 | asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | 574 | dotraplinkage void |
575 | do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | ||
576 | { | 576 | { |
577 | conditional_sti(regs); | 577 | conditional_sti(regs); |
578 | if (!user_mode(regs) && | 578 | if (!user_mode(regs) && |
@@ -581,7 +581,8 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | |||
581 | simd_math_error((void __user *)regs->ip); | 581 | simd_math_error((void __user *)regs->ip); |
582 | } | 582 | } |
583 | 583 | ||
584 | asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code) | 584 | dotraplinkage void |
585 | do_spurious_interrupt_bug(struct pt_regs *regs, long error_code) | ||
585 | { | 586 | { |
586 | } | 587 | } |
587 | 588 | ||
@@ -633,6 +634,12 @@ asmlinkage void math_state_restore(void) | |||
633 | } | 634 | } |
634 | EXPORT_SYMBOL_GPL(math_state_restore); | 635 | EXPORT_SYMBOL_GPL(math_state_restore); |
635 | 636 | ||
637 | dotraplinkage void __kprobes | ||
638 | do_device_not_available(struct pt_regs *regs, long error) | ||
639 | { | ||
640 | math_state_restore(); | ||
641 | } | ||
642 | |||
636 | void __init trap_init(void) | 643 | void __init trap_init(void) |
637 | { | 644 | { |
638 | set_intr_gate(0, ÷_error); | 645 | set_intr_gate(0, ÷_error); |