From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DGddL-00027T-Qd for qemu-devel@nongnu.org; Wed, 30 Mar 2005 08:53:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DGddI-00025w-Bu for qemu-devel@nongnu.org; Wed, 30 Mar 2005 08:53:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DGddH-00023g-GQ for qemu-devel@nongnu.org; Wed, 30 Mar 2005 08:53:19 -0500 Received: from [217.204.41.189] (helo=kula.newsnow.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1DGdDW-00070t-Br for qemu-devel@nongnu.org; Wed, 30 Mar 2005 08:26:42 -0500 Received: from r3j188.chello.upc.cz ([213.220.201.188] helo=[192.168.0.4]) by kula.newsnow.net with esmtp (Exim 3.35 #1 (Debian)) id 1DGdCC-0002Zz-00 for ; Wed, 30 Mar 2005 14:25:20 +0100 Message-ID: <424AA90A.1060103@praguespringpeople.org> Date: Wed, 30 Mar 2005 15:26:34 +0200 From: Struan Bartlett MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: Suggestion - trap window-close of VM References: <4247EBB0.6090409@praguespringpeople.org> <200503292352.20141.paul@codesourcery.com> <424A9994.1070508@praguespringpeople.org> <20050330124816.GA10714@xi.wantstofly.org> In-Reply-To: <20050330124816.GA10714@xi.wantstofly.org> Content-Type: multipart/alternative; boundary="------------060200000704040005050001" 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 This is a multi-part message in MIME format. --------------060200000704040005050001 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lennert Buytenhek wrote: >On Wed, Mar 30, 2005 at 02:20:36PM +0200, Struan Bartlett wrote: > > >>It subtracts one from the EIP (to find the address of >>the previously-executed instruction) and examines the virtual memory >>location pointed to. If the memory location contains 0xF4 (HLT) then it >>examines the EFLAGS register. If the IF (Interrupt-enable) flag is >>cleared, then one might in fact assume that Windows 2000 is sitting >>there just waiting for you to turn it off. The assumption here is that >>if interrupts are disabled then there is no way the processor's halt >>state can be interrupted. >> >> > >What happens if the previous instruction is a multi-byte instruction >that happens to have 0xf4 as its last byte? > > Before I did the IF check, that was a problem but now it should be ok. In your scenario, the IF flag would probably be found still to be set so it would be (correctly) assumed that Windows 2000 was not waiting to be turned off and qemu would continue normally. S --------------060200000704040005050001 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Lennert Buytenhek wrote:
On Wed, Mar 30, 2005 at 02:20:36PM +0200, Struan Bartlett wrote:
  
It subtracts one from the EIP (to find the address of 
the previously-executed instruction) and examines the virtual memory 
location pointed to. If the memory location contains 0xF4 (HLT) then it 
examines the EFLAGS register. If the IF (Interrupt-enable) flag is 
cleared, then one might in fact assume that Windows 2000 is sitting 
there just waiting for you to turn it off. The assumption here is that 
if interrupts are disabled then there is no way the processor's halt 
state can be interrupted.
    

What happens if the previous instruction is a multi-byte instruction
that happens to have 0xf4 as its last byte?
  
Before I did the IF check, that was a problem but now it should be ok. In your scenario, the IF flag would probably be found still to be set so it would be (correctly) assumed that Windows 2000 was not waiting to be turned off and qemu would continue normally.

S --------------060200000704040005050001--