qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Qemu workstation


From: Brad Campbell
Subject: Re: [Qemu-devel] Qemu workstation
Date: Wed, 07 Apr 2004 12:24:12 +0400
User-agent: Mozilla Thunderbird 0.5+ (X11/20040307)

Filip Navara wrote:
Brad Campbell wrote:

How does that work then?


I don't know the exact details.


I have some code that uses a NOP loop for accurate
timing? That spins at 100% cpu usage, how does a NOP tell the processor to idle? HLT does.


HLT instruction halts the CPU so no more instructions are
processed and the CPU freezes. That's usable only in situation
like Windows blue screens.

It does? My information tells me that it halts the processor until an interrupt or other wakeup source occurs. Check arch/i386/kernel/process.c

/*
 * We use this if we don't have any better
 * idle routine..
 */
void default_idle(void)
{
        if (current_cpu_data.hlt_works_ok && !hlt_counter) {
                __cli();
                if (!current->need_resched)
                        safe_halt();
                else
                        __sti();
        }
}

and in include/asm/system.h

system.h:#define safe_halt()            __asm__ __volatile__("sti; hlt": : 
:"memory")

Looks like a hlt to me and not a nop in site.
The kernel does a check at boot time to see if the processor supports the hlt instruction and if it does it uses that in the idle loop.

Am I wrong?

Brad




reply via email to

[Prev in Thread] Current Thread [Next in Thread]