Page MenuHomeFreeBSD

D46421.id142441.diff
No OneTemporary

D46421.id142441.diff

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

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)

Event Timeline