x86: traps.c declare functions before they get used
PATCH 1/1 x86: traps.c declare functions before they get used
In asm/traps.h :-do_double_fault : added under X86_64sync_regs : added under X86_64math_error : moved out from X86_32 as it is common for both 32 and 64 bit smp_thermal_interrupt : added under X86_64 mce_threshold_interrupt : added under X86_64math_emulate : moved from X86_32 to MATH_EMULATION
--- arch/x86/include/asm/traps.h | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
arch/x86/include/asm/traps.h +10 -1
@@ -46,6 +46,10 @@ dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long); dotraplinkage void do_invalid_TSS(struct pt_regs *, long); dotraplinkage void do_segment_not_present(struct pt_regs *, long); dotraplinkage void do_stack_segment(struct pt_regs *, long); +#ifdef CONFIG_X86_64 +dotraplinkage void do_double_fault(struct pt_regs *, long); +asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *); +#endif dotraplinkage void do_general_protection(struct pt_regs *, long); dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
@@ -72,9 +76,14 @@ static inline int get_si_code(unsigned long condition)extern int panic_on_unrecovered_nmi;extern int kstack_depth_to_print; -#ifdef CONFIG_X86_32 void math_error (void __user *); +#ifdef CONFIG_X86_32 unsigned long patch_espfix_desc (unsigned long ,unsigned long ); +#else +asmlinkage void smp_thermal_interrupt(void); +asmlinkage void mce_threshold_interrupt(void); +#endif +#ifndef CONFIG_MATH_EMULATION asmlinkage void math_emulate(long);#endif
Signature · 1 line
1.5.5.1
Quoted 33 lines · Jaswinder Singh
Signed-off-by Jaswinder Singh <[email protected]>In
asm/traps.h:-do_double_fault: added underX86_64sync_regs: added underX86_64math_error: moved out fromX86_32as it is common for both 32 and 64 bitsmp_thermal_interrupt: added underX86_64mce_threshold_interrupt: added underX86_64math_emulate: moved fromX86_32toMATH_EMULATION--- arch/x86/include/asm/traps.h | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)arch/x86/include/asm/traps.h +4
-1@@ -46,6 +46,10 @@ dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long); dotraplinkage void do_invalid_TSS(struct pt_regs *, long); dotraplinkage void do_segment_not_present(struct pt_regs *, long); dotraplinkage void do_stack_segment(struct pt_regs *, long); +#ifdef CONFIG_X86_64 +dotraplinkage void do_double_fault(struct pt_regs *, long); +asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *); +#endif dotraplinkage void do_general_protection(struct pt_regs *, long); dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);@@ -72,9 +76,14 @@ static inline int get_si_code(unsigned long condition)extern int panic_on_unrecovered_nmi;extern int kstack_depth_to_print; -#ifdef CONFIG_X86_32
arch/x86/include/asm/traps.h static inline int get_si_code(unsigned long condition) · line 88
Quoted 10 lines
arch/x86/include/asm/traps.h +6
-0void math_error (void __user *); +#ifdef CONFIG_X86_32 unsigned long patch_espfix_desc (unsigned long ,unsigned long ); +#else +asmlinkage void smp_thermal_interrupt(void); +asmlinkage void mce_threshold_interrupt(void); +#endif +#ifndef CONFIG_MATH_EMULATION asmlinkage void math_emulate(long);#endif
uhm, shouldnt that #ifndef CONFIG_MATH_EMULATION be #ifdef CONFIG_MATH_EMULATION?
Ingo
Hello Ingo,
Quoted 7 lines · Ingo Molnar
Quoted 3 lines
+#ifndef
CONFIG_MATH_EMULATION
asmlinkage voidmath_emulate(long);
#endifuhm, shouldnt that #ifndef
CONFIG_MATH_EMULATIONbe #ifdefCONFIG_MATH_EMULATION?
Sorry, but it seems correct to me in traps case will be opposite.
If someone tries to access math_emulate() and MATH_EMULATION is not defined then he will be trapped ;-)
Thank you,
Jaswinder Singh.
Quoted 7 lines · Jaswinder Singh
Hello Ingo,
Quoted 4 lines · Ingo Molnar
Quoted 3 lines
+#ifndef
CONFIG_MATH_EMULATION
asmlinkage voidmath_emulate(long);
#endif
Quoted 8 lines
Quoted 3 lines
uhm, shouldnt that #ifndef
CONFIG_MATH_EMULATIONbe #ifdefCONFIG_MATH_EMULATION?Sorry, but it seems correct to me in traps case will be opposite.
If someone tries to access
math_emulate()andMATH_EMULATIONis not defined then he will be trapped ;-)
you should build-test your patch with MATH_EMULATION enabled.
Ingo
Quoted 2 lines · Ingo Molnar
you should build-test your patch with
MATH_EMULATIONenabled.
I am sorry for this mess. Now I tested on X86_32 with and without MATH_EMULATION and also in X86_64. So here is new patch :
Subject: [PATCH] 86: traps.c declare functions before they get used
Impact: cleanup
In asm/traps.h :-do_double_fault : added under X86_64sync_regs : added under X86_64math_error : moved out from X86_32 as it is common for both 32 and 64 bit math_emulate : moved from X86_32 as it is common for both 32 and 64 bit smp_thermal_interrupt : added under X86_64 mce_threshold_interrupt : added under X86_64
--- arch/x86/include/asm/traps.h | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
arch/x86/include/asm/traps.h +9 -2
@@ -46,6 +46,10 @@ dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long); dotraplinkage void do_invalid_TSS(struct pt_regs *, long); dotraplinkage void do_segment_not_present(struct pt_regs *, long); dotraplinkage void do_stack_segment(struct pt_regs *, long); +#ifdef CONFIG_X86_64 +dotraplinkage void do_double_fault(struct pt_regs *, long); +asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *); +#endif dotraplinkage void do_general_protection(struct pt_regs *, long); dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
@@ -72,10 +76,13 @@ static inline int get_si_code(unsigned long condition)extern int panic_on_unrecovered_nmi;extern int kstack_depth_to_print; -#ifdef CONFIG_X86_32 void math_error (void __user *); -unsigned long patch_espfix_desc (unsigned long ,unsigned long ); asmlinkage void math_emulate(long); +#ifdef CONFIG_X86_32 +unsigned long patch_espfix_desc (unsigned long ,unsigned long ); +#else +asmlinkage void smp_thermal_interrupt(void); +asmlinkage void mce_threshold_interrupt(void);#endif #endif /* _ASM_X86_TRAPS_H */
Signature · 1 line
1.5.5.1