summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2003-10-19 11:35:44 +0000
committernyan <nyan@FreeBSD.org>2003-10-19 11:35:44 +0000
commiteb1cd59204f8bbd73c0e998cf6b445c03882e138 (patch)
treec0a3df64ef5c1753412f08566ce1ad55df7f3763 /sys/pc98
parentcda626230ec98e7c5af6e6b811e6510e11a08982 (diff)
downloadFreeBSD-src-eb1cd59204f8bbd73c0e998cf6b445c03882e138.zip
FreeBSD-src-eb1cd59204f8bbd73c0e998cf6b445c03882e138.tar.gz
MFi386: revision 1.577.
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/i386/machdep.c26
-rw-r--r--sys/pc98/pc98/machdep.c26
2 files changed, 34 insertions, 18 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index a09f7d6..abca2fe 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -1051,6 +1051,17 @@ static int cpu_idle_hlt = 1;
SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
&cpu_idle_hlt, 0, "Idle loop HLT enable");
+static void
+cpu_idle_default(void)
+{
+ /*
+ * we must absolutely guarentee that hlt is the
+ * absolute next instruction after sti or we
+ * introduce a timing window.
+ */
+ __asm __volatile("sti; hlt");
+}
+
/*
* Note that we have to be careful here to avoid a race between checking
* sched_runnable() and actually halting. If we don't do this, we may waste
@@ -1068,19 +1079,16 @@ cpu_idle(void)
if (cpu_idle_hlt) {
disable_intr();
- if (sched_runnable()) {
+ if (sched_runnable())
enable_intr();
- } else {
- /*
- * we must absolutely guarentee that hlt is the
- * absolute next instruction after sti or we
- * introduce a timing window.
- */
- __asm __volatile("sti; hlt");
- }
+ else
+ (*cpu_idle_hook)();
}
}
+/* Other subsystems (e.g., ACPI) can hook this later. */
+void (*cpu_idle_hook)(void) = cpu_idle_default;
+
/*
* Clear registers on exec
*/
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index a09f7d6..abca2fe 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -1051,6 +1051,17 @@ static int cpu_idle_hlt = 1;
SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
&cpu_idle_hlt, 0, "Idle loop HLT enable");
+static void
+cpu_idle_default(void)
+{
+ /*
+ * we must absolutely guarentee that hlt is the
+ * absolute next instruction after sti or we
+ * introduce a timing window.
+ */
+ __asm __volatile("sti; hlt");
+}
+
/*
* Note that we have to be careful here to avoid a race between checking
* sched_runnable() and actually halting. If we don't do this, we may waste
@@ -1068,19 +1079,16 @@ cpu_idle(void)
if (cpu_idle_hlt) {
disable_intr();
- if (sched_runnable()) {
+ if (sched_runnable())
enable_intr();
- } else {
- /*
- * we must absolutely guarentee that hlt is the
- * absolute next instruction after sti or we
- * introduce a timing window.
- */
- __asm __volatile("sti; hlt");
- }
+ else
+ (*cpu_idle_hook)();
}
}
+/* Other subsystems (e.g., ACPI) can hook this later. */
+void (*cpu_idle_hook)(void) = cpu_idle_default;
+
/*
* Clear registers on exec
*/
OpenPOWER on IntegriCloud