Subject: Re: Sleazy timing code
To: Jukka Marin <jmarin@pyy.jmp.fi>
From: Andreas Johansson <ajo@wopr.campus.luth.se>
List: port-alpha
Date: 05/30/2000 15:52:17
On Tue, 30 May 2000, Jukka Marin wrote:

> I believe NetBSD and other UN*X like operating systems are using something
> like this on i386 because I have heard from people that after replacing
> win* with UN*X, their CPU started running a lot cooler.  Obviously, win*
> keeps the CPU running some idle loop all the time (polling for keyboard,
> perhaps? ;-) while the more advanced OS'es know better.

Yes, CPU power management is supported by NetBSD. If your BIOS has APM
(Advanced Power Management), it is called from the idle-loop to reduce
power consumption on x86 machines:

ENTRY(idle)
        cli
        movl    _C_LABEL(whichqs),%ecx
        testl   %ecx,%ecx
        jnz     sw1
        sti
#if NAPM > 0
        call    _C_LABEL(apm_cpu_idle)
#endif
        hlt
#if NAPM > 0
        call    _C_LABEL(apm_cpu_busy)
#endif
        jmp     _C_LABEL(idle)

-- Snipped from arch/i386/i386/locore.s, NetBSD-1.4.1.

It also seems to me that the CPU is stopped until an interrupt occurs as
the "hlt" instruction is executed if nothing is in the runqueues.

>   -jm

/Andreas