* [Qemu-devel] [PATCH] Fix Harddisk initialization
@ 2006-02-21 19:29 Thiemo Seufer
2006-02-22 8:49 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Thiemo Seufer @ 2006-02-21 19:29 UTC (permalink / raw)
To: qemu-devel
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix Harddisk initialization
2006-02-21 19:29 [Qemu-devel] [PATCH] Fix Harddisk initialization Thiemo Seufer
@ 2006-02-22 8:49 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2006-02-22 8:49 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-22 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-21 19:29 [Qemu-devel] [PATCH] Fix Harddisk initialization Thiemo Seufer
2006-02-22 8:49 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).