From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BB8Lr-0003FT-Rp for qemu-devel@nongnu.org; Wed, 07 Apr 2004 04:24:03 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BB8L7-00025b-E6 for qemu-devel@nongnu.org; Wed, 07 Apr 2004 04:23:48 -0400 Received: from [203.29.88.42] (helo=gateway.ccdaust.com.au) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BB8L6-000229-Md for qemu-devel@nongnu.org; Wed, 07 Apr 2004 04:23:17 -0400 Received: from [192.168.2.80] (helo=wasp.net.au) by gateway.ccdaust.com.au with esmtp (Exim 3.35 #1 (Debian)) id 1BB8ZE-00071e-00 for ; Wed, 07 Apr 2004 16:37:53 +0800 Message-ID: <4073BAAC.5070904@wasp.net.au> Date: Wed, 07 Apr 2004 12:24:12 +0400 From: Brad Campbell MIME-Version: 1.0 Subject: Re: [Qemu-devel] Qemu workstation References: <200404051047.11383.jm@poure.com> <1081156203.3939.10.camel@aragorn> <4071B41F.3040201@bellard.org> <001601c41b57$ed1704f0$6407a8c0@shaggy> <20040406121738.GC2774@linux-m68k.org> <4072B070.3060700@wasp.net.au> <407311D8.5020403@volny.cz> <407384DE.4020900@wasp.net.au> <7992c6b079c0068519527b855dde759e@www3.mail.volny.cz> In-Reply-To: <7992c6b079c0068519527b855dde759e@www3.mail.volny.cz> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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