Commit a7dfe172fa839a10667264a99f307d143eb2cc92

Authored by bellard
1 parent 7fe48483

IDE standby fix for Linux 2.6 guest - segfault fix


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1111 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 18 additions and 0 deletions
hw/ide.c
... ... @@ -1567,6 +1567,10 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
1567 1567 goto abort_cmd;
1568 1568 }
1569 1569 break;
  1570 + case WIN_STANDBYNOW1:
  1571 + s->status = READY_STAT;
  1572 + ide_set_irq(s);
  1573 + break;
1570 1574 /* ATAPI commands */
1571 1575 case WIN_PIDENTIFY:
1572 1576 if (s->is_cdrom) {
... ... @@ -1784,6 +1788,16 @@ static uint32_t ide_data_readl(void *opaque, uint32_t addr)
1784 1788 return ret;
1785 1789 }
1786 1790  
  1791 +static void ide_dummy_transfer_stop(IDEState *s)
  1792 +{
  1793 + s->data_ptr = s->io_buffer;
  1794 + s->data_end = s->io_buffer;
  1795 + s->io_buffer[0] = 0xff;
  1796 + s->io_buffer[1] = 0xff;
  1797 + s->io_buffer[2] = 0xff;
  1798 + s->io_buffer[3] = 0xff;
  1799 +}
  1800 +
1787 1801 static void ide_reset(IDEState *s)
1788 1802 {
1789 1803 s->mult_sectors = MAX_MULT_SECTORS;
... ... @@ -1791,6 +1805,10 @@ static void ide_reset(IDEState *s)
1791 1805 s->select = 0xa0;
1792 1806 s->status = READY_STAT;
1793 1807 ide_set_signature(s);
  1808 + /* init the transfer handler so that 0xffff is returned on data
  1809 + accesses */
  1810 + s->end_transfer_func = ide_dummy_transfer_stop;
  1811 + ide_dummy_transfer_stop(s);
1794 1812 }
1795 1813  
1796 1814 struct partition {
... ...