Fix Harddisk initialization
PATCH 1/1 Fix Harddisk initialization
Hello All,
this fixes Harddisk initialization (s->nsector is initially 0x100, which is supposed to get handled as zero).
Thiemo
hw/ide.c +2 -2
@@ -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);
Quoted 18 lines · Thiemo Seufer
Hello All,
this fixes Harddisk initialization (
s->nsectoris initially0x100, which is supposed to get handled as zero).Thiemo
Index:
qemu-work/hw/ide.c
===================================================================hw/ide.c +0
-1@@ -1550,12 +1550,12 @@ide_set_irq (s);break ;case WIN_SETMULT : - if (s->nsector > MAX_MULT_SECTORS ||
hw/ide.c line 1561
Quoted 10 lines
hw/ide.c +2
-1+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.
Signature · 1 line
Jens Axboe