init.c 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  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. #include <linux/oprofile.h>
  10. #include <linux/init.h>
  11. #include <linux/errno.h>
  12. /* We support CPUs that have performance counters like the Pentium Pro
  13. * with the NMI mode driver.
  14. */
  15. extern int op_nmi_init(struct oprofile_operations * ops);
  16. extern int op_nmi_timer_init(struct oprofile_operations * ops);
  17. extern void op_nmi_exit(void);
  18. extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth);
  19. int __init oprofile_arch_init(struct oprofile_operations * ops)
  20. {
  21. int ret;
  22. ret = -ENODEV;
  23. #ifdef CONFIG_X86_LOCAL_APIC
  24. ret = op_nmi_init(ops);
  25. #endif
  26. #ifdef CONFIG_X86_IO_APIC
  27. if (ret < 0)
  28. ret = op_nmi_timer_init(ops);
  29. #endif
  30. ops->backtrace = x86_backtrace;
  31. return ret;
  32. }
  33. void oprofile_arch_exit(void)
  34. {
  35. #ifdef CONFIG_X86_LOCAL_APIC
  36. op_nmi_exit();
  37. #endif
  38. }