Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147783299
D46421.id142441.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46421.id142441.diff
View Options
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -45,6 +45,7 @@
#include "opt_clock.h"
#include "opt_cpu.h"
#include "opt_hwpmc_hooks.h"
+#include "opt_hwt_hooks.h"
#include "opt_isa.h"
#include "opt_kdb.h"
@@ -74,6 +75,10 @@
PMC_SOFT_DEFINE( , , page_fault, write);
#endif
+#ifdef HWT_HOOKS
+#include <dev/hwt/hwt_intr.h>
+#endif
+
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
@@ -202,6 +207,34 @@
},
};
+static __inline bool
+nmi_handle_pcint(struct trapframe *frame)
+{
+ bool handled = false;
+
+#ifdef HWT_HOOKS
+ /*
+ * Handle Intel PT interrupt if hwt is active.
+ */
+ if (hwt_intr != NULL &&
+ (*hwt_intr)(frame) != 0)
+ handled = true;
+#endif
+#ifdef HWPMC_HOOKS
+ /*
+ * CPU PMCs interrupt using an NMI. If the PMC module is
+ * active, pass the 'rip' value to the PMC module's interrupt
+ * handler. A non-zero return value means that
+ * the NMI was consumed by the handler.
+ */
+ if (pmc_intr != NULL &&
+ (*pmc_intr)(frame) != 0)
+ handled = true;
+#endif
+
+ return (handled);
+}
+
/*
* Exception, fault, and trap interface to the FreeBSD kernel.
* This common code is called from assembly language IDT gate entry
@@ -249,17 +282,8 @@
}
if (type == T_NMI) {
-#ifdef HWPMC_HOOKS
- /*
- * CPU PMCs interrupt using an NMI. If the PMC module is
- * active, pass the 'rip' value to the PMC module's interrupt
- * handler. A non-zero return value from the handler means that
- * the NMI was consumed by it and we can return immediately.
- */
- if (pmc_intr != NULL &&
- (*pmc_intr)(frame) != 0)
+ if (nmi_handle_pcint(frame))
return;
-#endif
}
if ((frame->tf_rflags & PSL_I) == 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 14, 3:17 PM (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29674853
Default Alt Text
D46421.id142441.diff (1 KB)
Attached To
Mode
D46421: x86: Refactor kernel-mode NMI handling
Attached
Detach File
Event Timeline
Log In to Comment