diff options
author | nyan <nyan@FreeBSD.org> | 2003-10-19 11:35:44 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2003-10-19 11:35:44 +0000 |
commit | eb1cd59204f8bbd73c0e998cf6b445c03882e138 (patch) | |
tree | c0a3df64ef5c1753412f08566ce1ad55df7f3763 /sys/pc98 | |
parent | cda626230ec98e7c5af6e6b811e6510e11a08982 (diff) | |
download | FreeBSD-src-eb1cd59204f8bbd73c0e998cf6b445c03882e138.zip FreeBSD-src-eb1cd59204f8bbd73c0e998cf6b445c03882e138.tar.gz |
MFi386: revision 1.577.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/i386/machdep.c | 26 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 26 |
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 */ |