xref: /OK3568_Linux_fs/kernel/arch/x86/oprofile/init.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /**
2*4882a593Smuzhiyun  * @file init.c
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * @remark Copyright 2002 OProfile authors
5*4882a593Smuzhiyun  * @remark Read the file COPYING
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * @author John Levon <levon@movementarian.org>
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include <linux/oprofile.h>
11*4882a593Smuzhiyun #include <linux/init.h>
12*4882a593Smuzhiyun #include <linux/errno.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * We support CPUs that have performance counters like the Pentium Pro
16*4882a593Smuzhiyun  * with the NMI mode driver.
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #ifdef CONFIG_X86_LOCAL_APIC
20*4882a593Smuzhiyun extern int op_nmi_init(struct oprofile_operations *ops);
21*4882a593Smuzhiyun extern void op_nmi_exit(void);
22*4882a593Smuzhiyun #else
op_nmi_init(struct oprofile_operations * ops)23*4882a593Smuzhiyun static int op_nmi_init(struct oprofile_operations *ops) { return -ENODEV; }
op_nmi_exit(void)24*4882a593Smuzhiyun static void op_nmi_exit(void) { }
25*4882a593Smuzhiyun #endif
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth);
28*4882a593Smuzhiyun 
oprofile_arch_init(struct oprofile_operations * ops)29*4882a593Smuzhiyun int __init oprofile_arch_init(struct oprofile_operations *ops)
30*4882a593Smuzhiyun {
31*4882a593Smuzhiyun 	ops->backtrace = x86_backtrace;
32*4882a593Smuzhiyun 	return op_nmi_init(ops);
33*4882a593Smuzhiyun }
34*4882a593Smuzhiyun 
oprofile_arch_exit(void)35*4882a593Smuzhiyun void oprofile_arch_exit(void)
36*4882a593Smuzhiyun {
37*4882a593Smuzhiyun 	op_nmi_exit();
38*4882a593Smuzhiyun }
39