提交 29c84391 编写于 作者: J Jan Kiszka 提交者: Jason Wessel

x86, kgdb: early trap init for early debug

Allow the x86 arch to have early exception processing for the purpose
of debugging via the kgdb.
Signed-off-by: NJan Kiszka <jan.kiszka@web.de>
Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
上级 4402c153
...@@ -789,6 +789,8 @@ static inline void wbinvd_halt(void) ...@@ -789,6 +789,8 @@ static inline void wbinvd_halt(void)
extern void enable_sep_cpu(void); extern void enable_sep_cpu(void);
extern int sysenter_setup(void); extern int sysenter_setup(void);
extern void early_trap_init(void);
/* Defined in head.S */ /* Defined in head.S */
extern struct desc_ptr early_gdt_descr; extern struct desc_ptr early_gdt_descr;
......
...@@ -725,6 +725,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -725,6 +725,7 @@ void __init setup_arch(char **cmdline_p)
/* VMI may relocate the fixmap; do this before touching ioremap area */ /* VMI may relocate the fixmap; do this before touching ioremap area */
vmi_init(); vmi_init();
early_trap_init();
early_cpu_init(); early_cpu_init();
early_ioremap_init(); early_ioremap_init();
......
...@@ -808,6 +808,16 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) ...@@ -808,6 +808,16 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code)
} }
#endif #endif
/* Set of traps needed for early debugging. */
void __init early_trap_init(void)
{
set_intr_gate_ist(1, &debug, DEBUG_STACK);
/* int3 can be called from all */
set_system_intr_gate_ist(3, &int3, DEBUG_STACK);
set_intr_gate(14, &page_fault);
load_idt(&idt_descr);
}
void __init trap_init(void) void __init trap_init(void)
{ {
int i; int i;
...@@ -821,10 +831,7 @@ void __init trap_init(void) ...@@ -821,10 +831,7 @@ void __init trap_init(void)
#endif #endif
set_intr_gate(0, &divide_error); set_intr_gate(0, &divide_error);
set_intr_gate_ist(1, &debug, DEBUG_STACK);
set_intr_gate_ist(2, &nmi, NMI_STACK); set_intr_gate_ist(2, &nmi, NMI_STACK);
/* int3 can be called from all */
set_system_intr_gate_ist(3, &int3, DEBUG_STACK);
/* int4 can be called from all */ /* int4 can be called from all */
set_system_intr_gate(4, &overflow); set_system_intr_gate(4, &overflow);
set_intr_gate(5, &bounds); set_intr_gate(5, &bounds);
...@@ -840,7 +847,6 @@ void __init trap_init(void) ...@@ -840,7 +847,6 @@ void __init trap_init(void)
set_intr_gate(11, &segment_not_present); set_intr_gate(11, &segment_not_present);
set_intr_gate_ist(12, &stack_segment, STACKFAULT_STACK); set_intr_gate_ist(12, &stack_segment, STACKFAULT_STACK);
set_intr_gate(13, &general_protection); set_intr_gate(13, &general_protection);
set_intr_gate(14, &page_fault);
set_intr_gate(15, &spurious_interrupt_bug); set_intr_gate(15, &spurious_interrupt_bug);
set_intr_gate(16, &coprocessor_error); set_intr_gate(16, &coprocessor_error);
set_intr_gate(17, &alignment_check); set_intr_gate(17, &alignment_check);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册