1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

MFi386: revision 1.577.

This commit is contained in:
Yoshihiro Takahashi 2003-10-19 11:35:44 +00:00
parent f59d5f7a9b
commit a1f83c968f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121243
2 changed files with 34 additions and 18 deletions

View File

@ -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
*/

View File

@ -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
*/