blob: 9e138d00ad36d1cd900284ba6549f9d64b19122e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
2 * @file init.c
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author John Levon <levon@movementarian.org>
8 */
9
10#include <linux/oprofile.h>
11#include <linux/init.h>
12#include <linux/errno.h>
Paolo Ciarrocchid717ca82008-02-22 23:09:50 +010013
14/*
15 * We support CPUs that have performance counters like the Pentium Pro
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 * with the NMI mode driver.
17 */
Paolo Ciarrocchid717ca82008-02-22 23:09:50 +010018
Robert Richterdcfce4a2011-10-11 17:11:08 +020019#ifdef CONFIG_X86_LOCAL_APIC
Paolo Ciarrocchid717ca82008-02-22 23:09:50 +010020extern int op_nmi_init(struct oprofile_operations *ops);
David Gibson96d08212005-09-06 15:17:26 -070021extern void op_nmi_exit(void);
Robert Richterdcfce4a2011-10-11 17:11:08 +020022#else
23static int op_nmi_init(struct oprofile_operations *ops) { return -ENODEV; }
24static void op_nmi_exit(void) { }
25#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Robert Richterdcfce4a2011-10-11 17:11:08 +020027extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth);
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Paolo Ciarrocchid717ca82008-02-22 23:09:50 +010029int __init oprofile_arch_init(struct oprofile_operations *ops)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 ops->backtrace = x86_backtrace;
Robert Richterdcfce4a2011-10-11 17:11:08 +020032 return op_nmi_init(ops);
Linus Torvalds1da177e2005-04-16 15:20:36 -070033}
34
Linus Torvalds1da177e2005-04-16 15:20:36 -070035void oprofile_arch_exit(void)
36{
Robert Richterdcfce4a2011-10-11 17:11:08 +020037 op_nmi_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}