summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/mp_machdep.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-04-30 23:12:37 +0000
committerattilio <attilio@FreeBSD.org>2011-04-30 23:12:37 +0000
commit1ce93775ecf7328fdda6b30ca7461bec07e27812 (patch)
tree585e7bffe2f2f8a566e9cbc1448fb376ca47bcf9 /sys/amd64/amd64/mp_machdep.c
parent05a159a130624404fd72473d6a0b3fc99176ea86 (diff)
downloadFreeBSD-src-1ce93775ecf7328fdda6b30ca7461bec07e27812.zip
FreeBSD-src-1ce93775ecf7328fdda6b30ca7461bec07e27812.tar.gz
Add the function md_assert_nopreempt(), which is a very consistent
function on the possibility of a thread to not preempt. As this function is very tied to x86 (interrupts disabled checkings) it is not intended to be used in MI code.
Diffstat (limited to 'sys/amd64/amd64/mp_machdep.c')
-rw-r--r--sys/amd64/amd64/mp_machdep.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 8e8dc67..70ba466 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -1428,6 +1428,22 @@ cpususpend_handler(void)
intr_restore(rf);
}
+void
+md_assert_nopreempt(void)
+{
+#ifdef INVARIANTS
+ struct thread *td;
+ register_t rflags;
+
+ td = curthread;
+ rflags = read_rflags();
+
+ if ((rflags & PSL_I) != 0 && td->td_critnest <= 0)
+ panic("Preemption still allowed, thread %s\n",
+ (td->td_pinned <= 0) ? "not pinned" : "pinned");
+#endif
+}
+
/*
* This is called once the rest of the system is up and running and we're
* ready to let the AP's out of the pen.
OpenPOWER on IntegriCloud