From c921000af6782a6a35da8e3b3482b3737c49ac23 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 20 Aug 2025 00:56:31 -0400 Subject: kernel: exit: Panic if core is not preemptable Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/proc_machdep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys/arch') diff --git a/sys/arch/amd64/amd64/proc_machdep.c b/sys/arch/amd64/amd64/proc_machdep.c index 11b1901..82b4e4f 100644 --- a/sys/arch/amd64/amd64/proc_machdep.c +++ b/sys/arch/amd64/amd64/proc_machdep.c @@ -281,6 +281,18 @@ sched_preempt_set(bool enable) ci->preempt = enable; } +bool +sched_preemptable(void) +{ + struct cpu_info *ci = this_cpu(); + + if (ci == NULL) { + return false; + } + + return ci->preempt; +} + /* * Perform a context switch. */ -- cgit v1.2.3