@@ -68,6 +68,15 @@ static const __initdata struct idt_data early_idts[] = {
68
68
static const __initdata struct idt_data early_pf_idts [] = {
69
69
INTG (X86_TRAP_PF , page_fault ),
70
70
};
71
+
72
+ /*
73
+ * Override for the debug_idt. Same as the default, but with interrupt
74
+ * stack set to DEFAULT_STACK (0). Required for NMI trap handling.
75
+ */
76
+ static const __initdata struct idt_data dbg_idts [] = {
77
+ INTG (X86_TRAP_DB , debug ),
78
+ INTG (X86_TRAP_BP , int3 ),
79
+ };
71
80
#endif
72
81
73
82
/* Must be page-aligned because the real IDT is used in a fixmap. */
@@ -82,6 +91,10 @@ struct desc_ptr idt_descr __ro_after_init = {
82
91
/* No need to be aligned, but done to keep all IDTs defined the same way. */
83
92
gate_desc debug_idt_table [IDT_ENTRIES ] __page_aligned_bss ;
84
93
94
+ /*
95
+ * Override for the debug_idt. Same as the default, but with interrupt
96
+ * stack set to DEFAULT_STACK (0). Required for NMI trap handling.
97
+ */
85
98
const struct desc_ptr debug_idt_descr = {
86
99
.size = IDT_ENTRIES * 16 - 1 ,
87
100
.address = (unsigned long ) debug_idt_table ,
@@ -143,6 +156,16 @@ void __init idt_setup_early_pf(void)
143
156
idt_setup_from_table (idt_table , early_pf_idts ,
144
157
ARRAY_SIZE (early_pf_idts ));
145
158
}
159
+
160
+ /**
161
+ * idt_setup_debugidt_traps - Initialize the debug idt table with debug traps
162
+ */
163
+ void __init idt_setup_debugidt_traps (void )
164
+ {
165
+ memcpy (& debug_idt_table , & idt_table , IDT_ENTRIES * 16 );
166
+
167
+ idt_setup_from_table (debug_idt_table , dbg_idts , ARRAY_SIZE (dbg_idts ));
168
+ }
146
169
#endif
147
170
148
171
/**
0 commit comments