diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/i386/oprofile/nmi_timer_int.c |
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/i386/oprofile/nmi_timer_int.c')
-rw-r--r-- | arch/i386/oprofile/nmi_timer_int.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/i386/oprofile/nmi_timer_int.c b/arch/i386/oprofile/nmi_timer_int.c new file mode 100644 index 00000000000..b2e462abf33 --- /dev/null +++ b/arch/i386/oprofile/nmi_timer_int.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /** | ||
2 | * @file nmi_timer_int.c | ||
3 | * | ||
4 | * @remark Copyright 2003 OProfile authors | ||
5 | * @remark Read the file COPYING | ||
6 | * | ||
7 | * @author Zwane Mwaikambo <zwane@linuxpower.ca> | ||
8 | */ | ||
9 | |||
10 | #include <linux/init.h> | ||
11 | #include <linux/smp.h> | ||
12 | #include <linux/irq.h> | ||
13 | #include <linux/oprofile.h> | ||
14 | #include <linux/rcupdate.h> | ||
15 | |||
16 | |||
17 | #include <asm/nmi.h> | ||
18 | #include <asm/apic.h> | ||
19 | #include <asm/ptrace.h> | ||
20 | |||
21 | static int nmi_timer_callback(struct pt_regs * regs, int cpu) | ||
22 | { | ||
23 | oprofile_add_sample(regs, 0); | ||
24 | return 1; | ||
25 | } | ||
26 | |||
27 | static int timer_start(void) | ||
28 | { | ||
29 | disable_timer_nmi_watchdog(); | ||
30 | set_nmi_callback(nmi_timer_callback); | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | |||
35 | static void timer_stop(void) | ||
36 | { | ||
37 | enable_timer_nmi_watchdog(); | ||
38 | unset_nmi_callback(); | ||
39 | synchronize_kernel(); | ||
40 | } | ||
41 | |||
42 | |||
43 | int __init nmi_timer_init(struct oprofile_operations * ops) | ||
44 | { | ||
45 | extern int nmi_active; | ||
46 | |||
47 | if (nmi_active <= 0) | ||
48 | return -ENODEV; | ||
49 | |||
50 | ops->start = timer_start; | ||
51 | ops->stop = timer_stop; | ||
52 | ops->cpu_type = "timer"; | ||
53 | printk(KERN_INFO "oprofile: using NMI timer interrupt.\n"); | ||
54 | return 0; | ||
55 | } | ||