summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/proc_machdep.c18
-rw-r--r--sys/include/sys/sched.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/sys/arch/amd64/amd64/proc_machdep.c b/sys/arch/amd64/amd64/proc_machdep.c
index 56348be..11b1901 100644
--- a/sys/arch/amd64/amd64/proc_machdep.c
+++ b/sys/arch/amd64/amd64/proc_machdep.c
@@ -264,6 +264,24 @@ sched_switch_to(struct trapframe *tf, struct proc *td)
}
/*
+ * Enable or disable preemption on the current
+ * processor
+ *
+ * @enable: Enable preemption if true
+ */
+void
+sched_preempt_set(bool enable)
+{
+ struct cpu_info *ci = this_cpu();
+
+ if (ci == NULL) {
+ return;
+ }
+
+ ci->preempt = enable;
+}
+
+/*
* Perform a context switch.
*/
void
diff --git a/sys/include/sys/sched.h b/sys/include/sys/sched.h
index 8b0ba02..8deef95 100644
--- a/sys/include/sys/sched.h
+++ b/sys/include/sys/sched.h
@@ -66,6 +66,7 @@ struct sched_stat {
void sched_stat(struct sched_stat *statp);
void sched_init(void);
+void sched_preempt_set(bool enable);
void sched_yield(void);
void sched_suspend(struct proc *td, const struct timeval *tv);
void sched_detach(struct proc *td);