summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kern/thread.c6
-rw-r--r--kern/thread.h9
-rw-r--r--kern/xcall.c3
3 files changed, 12 insertions, 6 deletions
diff --git a/kern/thread.c b/kern/thread.c
index 550de7ee..d121a6aa 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -2487,8 +2487,7 @@ thread_schedule_intr(void)
{
struct thread_runq *runq;
- assert(!cpu_intr_enabled());
- assert(!thread_preempt_enabled());
+ thread_assert_interrupted();
runq = thread_runq_local();
syscnt_inc(&runq->sc_schedule_intrs);
@@ -2501,8 +2500,7 @@ thread_tick_intr(void)
struct thread_runq *runq;
struct thread *thread;
- assert(!cpu_intr_enabled());
- assert(!thread_preempt_enabled());
+ thread_assert_interrupted();
runq = thread_runq_local();
syscnt_inc(&runq->sc_tick_intrs);
diff --git a/kern/thread.h b/kern/thread.h
index 486d6fae..c7f68f14 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -43,6 +43,7 @@
#include <kern/spinlock_types.h>
#include <kern/turnstile_types.h>
#include <machine/atomic.h>
+#include <machine/cpu.h>
#include <machine/tcb.h>
/*
@@ -642,6 +643,14 @@ thread_intr_leave(void)
}
}
+static inline void
+thread_assert_interrupted(void)
+{
+ assert(thread_interrupted());
+ assert(!cpu_intr_enabled());
+ assert(!thread_preempt_enabled());
+}
+
/*
* Lockless synchronization read-side critical section nesting counter
* control functions.
diff --git a/kern/xcall.c b/kern/xcall.c
index c36f3c48..b3b01e2b 100644
--- a/kern/xcall.c
+++ b/kern/xcall.c
@@ -160,8 +160,7 @@ xcall_intr(void)
struct xcall_cpu_data *cpu_data;
struct xcall *call;
- assert(!cpu_intr_enabled());
- assert(!thread_preempt_enabled());
+ thread_assert_interrupted();
cpu_data = xcall_cpu_data_get();
call = xcall_cpu_data_get_recv_call(cpu_data);