x86: traps and do_traps under one hood
Subsystems (2)
PATCH 1/1 x86: traps and do_traps under one hood
Declaring x86 traps under one hood.
Declaring x86 do_traps before defining them.
--- arch/x86/kernel/traps_32.c | 20 --------- arch/x86/kernel/traps_64.c | 21 ---------- include/asm-x86/mach-default/mach_traps.h | 62 +++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 41 deletions(-)
arch/x86/kernel/traps_32.c +0 -20
@@ -77,26 +77,6 @@ char ignore_fpu_irq; gate_desc idt_table[256] __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; -asmlinkage void divide_error(void); -asmlinkage void debug(void); -asmlinkage void nmi(void); -asmlinkage void int3(void); -asmlinkage void overflow(void); -asmlinkage void bounds(void); -asmlinkage void invalid_op(void); -asmlinkage void device_not_available(void); -asmlinkage void coprocessor_segment_overrun(void); -asmlinkage void invalid_TSS(void); -asmlinkage void segment_not_present(void); -asmlinkage void stack_segment(void); -asmlinkage void general_protection(void); -asmlinkage void page_fault(void); -asmlinkage void coprocessor_error(void); -asmlinkage void simd_coprocessor_error(void); -asmlinkage void alignment_check(void); -asmlinkage void spurious_interrupt_bug(void); -asmlinkage void machine_check(void); -int panic_on_unrecovered_nmi;int kstack_depth_to_print =24 ;static unsigned int code_bytes =64 ;
arch/x86/kernel/traps_64.c +0 -21
@@ -54,27 +54,6 @@#include <mach_traps.h> -asmlinkage void divide_error(void); -asmlinkage void debug(void); -asmlinkage void nmi(void); -asmlinkage void int3(void); -asmlinkage void overflow(void); -asmlinkage void bounds(void); -asmlinkage void invalid_op(void); -asmlinkage void device_not_available(void); -asmlinkage void double_fault(void); -asmlinkage void coprocessor_segment_overrun(void); -asmlinkage void invalid_TSS(void); -asmlinkage void segment_not_present(void); -asmlinkage void stack_segment(void); -asmlinkage void general_protection(void); -asmlinkage void page_fault(void); -asmlinkage void coprocessor_error(void); -asmlinkage void simd_coprocessor_error(void); -asmlinkage void alignment_check(void); -asmlinkage void spurious_interrupt_bug(void); -asmlinkage void machine_check(void); -int panic_on_unrecovered_nmi;int kstack_depth_to_print =12 ;static unsigned int code_bytes =64 ;
include/asm-x86/mach-default/mach_traps.h +62 -0
66 lines not on this page · raw message
Signature · 1 line
1.5.5.1
Quoted 10 lines · Jaswinder Singh
Declaring x86 traps under one hood.
Declaring x86do_trapsbefore defining them.Signed-off-by Jaswinder Singh <[email protected]>--- arch/x86/kernel/traps_32.c | 20 --------- arch/x86/kernel/traps_64.c | 21 ---------- include/asm-x86/mach-default/mach_traps.h | 62 +++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 41 deletions(-)
Hi Jaswinder,
I think moving the declarations to a header file is a good thing, but I don't think mach_traps.h is a suitable place. The definitions of the functions are in entry_32.S and entry_64.S, so I would suggest making a new header include/asm-x86/entry.h. Some other ENTRY's (like system_call and some xen-specific ones) would then also fit in this header.
What do you think?
Greetings,
Alexander
Quoted 148 lines
arch/x86/kernel/traps_32.c +0
-20@@ -77,26 +77,6 @@ char ignore_fpu_irq; gate_desc idt_table[256] __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; -asmlinkage void divide_error(void); -asmlinkage void debug(void); -asmlinkage void nmi(void); -asmlinkage void int3(void); -asmlinkage void overflow(void); -asmlinkage void bounds(void); -asmlinkage void invalid_op(void); -asmlinkage void device_not_available(void); -asmlinkage void coprocessor_segment_overrun(void); -asmlinkage void invalid_TSS(void); -asmlinkage void segment_not_present(void); -asmlinkage void stack_segment(void); -asmlinkage void general_protection(void); -asmlinkage void page_fault(void); -asmlinkage void coprocessor_error(void); -asmlinkage void simd_coprocessor_error(void); -asmlinkage void alignment_check(void); -asmlinkage void spurious_interrupt_bug(void); -asmlinkage void machine_check(void); -int panic_on_unrecovered_nmi;int kstack_depth_to_print =24 ;static unsigned int code_bytes =64 ;arch/x86/kernel/traps_64.c +0
-21@@ -54,27 +54,6 @@#include <mach_traps.h> -asmlinkage void divide_error(void); -asmlinkage void debug(void); -asmlinkage void nmi(void); -asmlinkage void int3(void); -asmlinkage void overflow(void); -asmlinkage void bounds(void); -asmlinkage void invalid_op(void); -asmlinkage void device_not_available(void); -asmlinkage void double_fault(void); -asmlinkage void coprocessor_segment_overrun(void); -asmlinkage void invalid_TSS(void); -asmlinkage void segment_not_present(void); -asmlinkage void stack_segment(void); -asmlinkage void general_protection(void); -asmlinkage void page_fault(void); -asmlinkage void coprocessor_error(void); -asmlinkage void simd_coprocessor_error(void); -asmlinkage void alignment_check(void); -asmlinkage void spurious_interrupt_bug(void); -asmlinkage void machine_check(void); -int panic_on_unrecovered_nmi;int kstack_depth_to_print =12 ;static unsigned int code_bytes =64 ;include/asm-x86/mach-default/mach_traps.h +62
-0@@ -36,4 +36,66 @@ static inline void reassert_nmi(void) unlock_cmos(); } +/* traps */ + +/* Common in X86_32 and X86_64 */ +asmlinkage void divide_error(void); +asmlinkage void debug(void); +asmlinkage void nmi(void); +asmlinkage void int3(void); +asmlinkage void overflow(void); +asmlinkage void bounds(void); +asmlinkage void invalid_op(void); +asmlinkage void device_not_available(void); +asmlinkage void coprocessor_segment_overrun(void); +asmlinkage void invalid_TSS(void); +asmlinkage void segment_not_present(void); +asmlinkage void stack_segment(void); +asmlinkage void general_protection(void); +asmlinkage void page_fault(void); +asmlinkage void coprocessor_error(void); +asmlinkage void simd_coprocessor_error(void); +asmlinkage void alignment_check(void); +asmlinkage void spurious_interrupt_bug(void); +asmlinkage void machine_check(void); + +void do_divide_error (struct pt_regs *,long ); +void do_overflow (struct pt_regs *,long ); +void do_bounds (struct pt_regs *,long ); +void do_coprocessor_segment_overrun (struct pt_regs *,long ); +void do_invalid_TSS (struct pt_regs *,long ); +void do_segment_not_present (struct pt_regs *,long ); +void do_stack_segment (struct pt_regs *,long ); +void do_alignment_check (struct pt_regs *,long ); +void do_invalid_op (struct pt_regs *,long ); +void do_general_protection (struct pt_regs *,long ); +void do_nmi (struct pt_regs *,long ); + +extern int panic_on_unrecovered_nmi; +extern int kstack_depth_to_print; + +#ifdef CONFIG_X86_32 + +void do_iret_error (struct pt_regs *,long ); +void do_int3 (struct pt_regs *,long ); +void do_debug (struct pt_regs *,long ); +void math_error (void __user *); +void do_coprocessor_error (struct pt_regs *,long ); +void do_simd_coprocessor_error (struct pt_regs *,long ); +void do_spurious_interrupt_bug (struct pt_regs *,long ); +unsigned long patch_espfix_desc (unsigned long ,unsigned long ); +asmlinkage void math_emulate(long); + +#else /* CONFIG_X86_32 */ + +asmlinkage void double_fault(void); + +asmlinkage void do_int3(struct pt_regs *, long); +asmlinkage void do_stack_segment(struct pt_regs *, long); +asmlinkage void do_debug(struct pt_regs *, unsigned long); +asmlinkage void do_coprocessor_error(struct pt_regs *); +asmlinkage void do_simd_coprocessor_error(struct pt_regs *); +asmlinkage void do_spurious_interrupt_bug(struct pt_regs *); + +#endif /* CONFIG_X86_32 */ #endif /* !_MACH_TRAPS_H */ Signature · 10 lines
1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 10 lines
Alexander van Heukelum [email protected] -- http://www.fastmail.fm - Same, same, but different… -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Alexander,
Quoted 3 lines · Alexander van Heukelum
I think moving the declarations to a header file is a good thing, but I don't think
mach_traps.his a suitable place.
I CC new patch to you : [PATCH] x86: Introducing asm-x86/traps.h
Quoted 7 lines
The definitions
of the functions are inentry_32.Sandentry_64.S, so I would suggest making a new headerinclude/asm-x86/entry.h. Some other ENTRY's (likesystem_calland some xen-specific ones) would then also fit in this header.What do you think?
I did this for traps_32.c and traps_64.c because they are complaining that traps are defined but not declared.
Thank you,
Jaswinder Singh.
Quoted 6 lines · Jaswinder Singh
Declaring x86 traps under one hood.
Declaring x86do_trapsbefore defining them.arch/x86/kernel/traps_32.c | 20 --------- arch/x86/kernel/traps_64.c | 21 ---------- include/asm-x86/mach-default/mach_traps.h | 62 +++++++++++++++++++++++++++++
You put these back in mach-default/mach_traps.h but does that cover all possibilities? What about other machine types?
Looking at the ifdefs you introduced in that header, it seems there's more scope for unification here (although it makes sense for that to come later).
Signature · 1 line
dwmw2