aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorSeiji Aguchi <seiji.aguchi@hds.com>2013-10-30 16:37:00 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2013-11-08 17:15:45 -0500
commit25c74b10bacead867478480170083f69cfc0db48 (patch)
tree750066787398c55825485341988e19af9776b562 /arch/x86/include
parent959c071f0974cda7702d7574647de7ad9259eb57 (diff)
x86, trace: Register exception handler to trace IDT
This patch registers exception handlers for tracing to a trace IDT. To implemented it in set_intr_gate(), this patch does followings. - Register the exception handlers to the trace IDT by prepending "trace_" to the handler's names. - Also, newly introduce trace_page_fault() to add tracepoints in a subsequent patch. Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com> Link: http://lkml.kernel.org/r/52716DEC.5050204@hds.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/desc.h28
-rw-r--r--arch/x86/include/asm/hw_irq.h3
-rw-r--r--arch/x86/include/asm/segment.h3
-rw-r--r--arch/x86/include/asm/traps.h20
4 files changed, 49 insertions, 5 deletions
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index d93956744cfd..3d73437600d7 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -327,10 +327,25 @@ static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
327{ 327{
328 write_idt_entry(trace_idt_table, entry, gate); 328 write_idt_entry(trace_idt_table, entry, gate);
329} 329}
330
331static inline void _trace_set_gate(int gate, unsigned type, void *addr,
332 unsigned dpl, unsigned ist, unsigned seg)
333{
334 gate_desc s;
335
336 pack_gate(&s, type, (unsigned long)addr, dpl, ist, seg);
337 /*
338 * does not need to be atomic because it is only done once at
339 * setup time
340 */
341 write_trace_idt_entry(gate, &s);
342}
330#else 343#else
331static inline void write_trace_idt_entry(int entry, const gate_desc *gate) 344static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
332{ 345{
333} 346}
347
348#define _trace_set_gate(gate, type, addr, dpl, ist, seg)
334#endif 349#endif
335 350
336static inline void _set_gate(int gate, unsigned type, void *addr, 351static inline void _set_gate(int gate, unsigned type, void *addr,
@@ -353,11 +368,14 @@ static inline void _set_gate(int gate, unsigned type, void *addr,
353 * Pentium F0 0F bugfix can have resulted in the mapped 368 * Pentium F0 0F bugfix can have resulted in the mapped
354 * IDT being write-protected. 369 * IDT being write-protected.
355 */ 370 */
356static inline void set_intr_gate(unsigned int n, void *addr) 371#define set_intr_gate(n, addr) \
357{ 372 do { \
358 BUG_ON((unsigned)n > 0xFF); 373 BUG_ON((unsigned)n > 0xFF); \
359 _set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS); 374 _set_gate(n, GATE_INTERRUPT, (void *)addr, 0, 0, \
360} 375 __KERNEL_CS); \
376 _trace_set_gate(n, GATE_INTERRUPT, (void *)trace_##addr,\
377 0, 0, __KERNEL_CS); \
378 } while (0)
361 379
362extern int first_system_vector; 380extern int first_system_vector;
363/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */ 381/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 92b3bae08b74..cba45d99ac1a 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -187,6 +187,9 @@ extern __visible void smp_invalidate_interrupt(struct pt_regs *);
187#endif 187#endif
188 188
189extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void); 189extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void);
190#ifdef CONFIG_TRACING
191#define trace_interrupt interrupt
192#endif
190 193
191typedef int vector_irq_t[NR_VECTORS]; 194typedef int vector_irq_t[NR_VECTORS];
192DECLARE_PER_CPU(vector_irq_t, vector_irq); 195DECLARE_PER_CPU(vector_irq_t, vector_irq);
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index c48a95035a77..6f1c3a8a33ab 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -214,6 +214,9 @@
214#ifdef __KERNEL__ 214#ifdef __KERNEL__
215#ifndef __ASSEMBLY__ 215#ifndef __ASSEMBLY__
216extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5]; 216extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5];
217#ifdef CONFIG_TRACING
218#define trace_early_idt_handlers early_idt_handlers
219#endif
217 220
218/* 221/*
219 * Load a segment. Fall back on loading the zero 222 * Load a segment. Fall back on loading the zero
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 7036cb60cd87..58d66fe06b61 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -37,6 +37,23 @@ asmlinkage void machine_check(void);
37#endif /* CONFIG_X86_MCE */ 37#endif /* CONFIG_X86_MCE */
38asmlinkage void simd_coprocessor_error(void); 38asmlinkage void simd_coprocessor_error(void);
39 39
40#ifdef CONFIG_TRACING
41asmlinkage void trace_page_fault(void);
42#define trace_divide_error divide_error
43#define trace_bounds bounds
44#define trace_invalid_op invalid_op
45#define trace_device_not_available device_not_available
46#define trace_coprocessor_segment_overrun coprocessor_segment_overrun
47#define trace_invalid_TSS invalid_TSS
48#define trace_segment_not_present segment_not_present
49#define trace_general_protection general_protection
50#define trace_spurious_interrupt_bug spurious_interrupt_bug
51#define trace_coprocessor_error coprocessor_error
52#define trace_alignment_check alignment_check
53#define trace_simd_coprocessor_error simd_coprocessor_error
54#define trace_async_page_fault async_page_fault
55#endif
56
40dotraplinkage void do_divide_error(struct pt_regs *, long); 57dotraplinkage void do_divide_error(struct pt_regs *, long);
41dotraplinkage void do_debug(struct pt_regs *, long); 58dotraplinkage void do_debug(struct pt_regs *, long);
42dotraplinkage void do_nmi(struct pt_regs *, long); 59dotraplinkage void do_nmi(struct pt_regs *, long);
@@ -55,6 +72,9 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *);
55#endif 72#endif
56dotraplinkage void do_general_protection(struct pt_regs *, long); 73dotraplinkage void do_general_protection(struct pt_regs *, long);
57dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); 74dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
75#ifdef CONFIG_TRACING
76dotraplinkage void trace_do_page_fault(struct pt_regs *, unsigned long);
77#endif
58dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long); 78dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
59dotraplinkage void do_coprocessor_error(struct pt_regs *, long); 79dotraplinkage void do_coprocessor_error(struct pt_regs *, long);
60dotraplinkage void do_alignment_check(struct pt_regs *, long); 80dotraplinkage void do_alignment_check(struct pt_regs *, long);