diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2005-05-30 06:29:29 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2005-05-30 06:29:29 +0000 |
commit | ad86ac4ba488543f1b0c0667a071e2bb197b7f9a (patch) | |
tree | 7e883bbffeb74552930e9883202ed3d7c3123a4a /sys/i386 | |
parent | f570134192d2d751237ed54f0fb9baa2fea5aeb5 (diff) | |
download | FreeBSD-src-ad86ac4ba488543f1b0c0667a071e2bb197b7f9a.zip FreeBSD-src-ad86ac4ba488543f1b0c0667a071e2bb197b7f9a.tar.gz |
Kernel hooks to support PMC sampling modes.
Reviewed by: alc
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/trap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 2bca068..bb02052 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -72,6 +72,9 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include <sys/ktrace.h> #endif +#ifdef HWPMC_HOOKS +#include <sys/pmckern.h> +#endif #include <vm/vm.h> #include <vm/vm_param.h> @@ -198,6 +201,20 @@ trap(frame) } #endif +#ifdef HWPMC_HOOKS + /* + * CPU PMCs interrupt using an NMI so we check for that first. + * If the HWPMC module is active, 'pmc_hook' will point to + * the function to be called. A return value of '1' from the + * hook means that the NMI was handled by it and that we can + * return immediately. + */ + if (type == T_NMI && pmc_intr && + (*pmc_intr)(PCPU_GET(cpuid), (uintptr_t) frame.tf_eip, + TRAPF_USERMODE(&frame))) + goto out; +#endif + if ((frame.tf_eflags & PSL_I) == 0) { /* * Buggy application or kernel code has disabled |