From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FBpkD-0002b0-BP for qemu-devel@nongnu.org; Wed, 22 Feb 2006 03:53:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FBpgU-0000ec-Mx for qemu-devel@nongnu.org; Wed, 22 Feb 2006 03:49:21 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FBpgN-0000Uv-67 for qemu-devel@nongnu.org; Wed, 22 Feb 2006 03:49:11 -0500 Received: from [195.184.98.160] (helo=virtualhost.dk) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1FBpmo-0001n9-Qi for qemu-devel@nongnu.org; Wed, 22 Feb 2006 03:55:51 -0500 Received: from [62.242.22.158] (helo=router.home.kernel.dk) by virtualhost.dk with esmtp (Exim 3.36 #1) id 1FBpgL-0002PB-00 for qemu-devel@nongnu.org; Wed, 22 Feb 2006 09:49:09 +0100 Received: from nelson.home.kernel.dk ([192.168.0.33] helo=kernel.dk) by router.home.kernel.dk with esmtp (Exim 4.51) id 1FBpgK-0001FU-9p for qemu-devel@nongnu.org; Wed, 22 Feb 2006 09:49:08 +0100 Date: Wed, 22 Feb 2006 09:49:17 +0100 From: Jens Axboe Subject: Re: [Qemu-devel] [PATCH] Fix Harddisk initialization Message-ID: <20060222084917.GO8852@suse.de> References: <20060221192928.GD4110@networkno.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060221192928.GD4110@networkno.de> 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 On Tue, Feb 21 2006, Thiemo Seufer wrote: > Hello All, > > this fixes Harddisk initialization (s->nsector is initially 0x100, which > is supposed to get handled as zero). > > > Thiemo > > > Index: qemu-work/hw/ide.c > =================================================================== > --- qemu-work.orig/hw/ide.c 2006-02-18 22:12:56.000000000 +0000 > +++ qemu-work/hw/ide.c 2006-02-19 02:34:13.000000000 +0000 > @@ -1550,12 +1550,12 @@ > ide_set_irq(s); > break; > case WIN_SETMULT: > - if (s->nsector > MAX_MULT_SECTORS || > + if ((s->nsector & 0xFF) > MAX_MULT_SECTORS || > s->nsector == 0 || > (s->nsector & (s->nsector - 1)) != 0) { > ide_abort_command(s); > } else { > - s->mult_sectors = s->nsector; > + s->mult_sectors = s->nsector & 0xFF; > s->status = READY_STAT; > } > ide_set_irq(s); I think the much better patch would be to fix qemu not to put 256 unconditionally in ->nsector if it is written as zero. It's really a special case for only the read/write commands, not a generel fixup. I'd suggest adding a nsector_internal to fixup this internally in the read/write path so all register correctly reflect what was actually written by the OS. -- Jens Axboe