diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-24 14:33:24 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-24 14:33:24 +0000 |
commit | 33f002714be2ed58ed05ae3870d5ea6915df4b47 (patch) | |
tree | 6b5f907e0c0b42bc6ca4222f1e14462be5e30c1a /hw/ide.c | |
parent | 3e98dc8ec6af89c7f4f1e006b979eb405b431629 (diff) | |
download | qemu-33f002714be2ed58ed05ae3870d5ea6915df4b47.tar.gz qemu-33f002714be2ed58ed05ae3870d5ea6915df4b47.tar.bz2 qemu-33f002714be2ed58ed05ae3870d5ea6915df4b47.zip |
Add "cache" parameter to "-drive" (Laurent Vivier).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3848 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ide.c')
-rw-r--r-- | hw/ide.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -365,7 +365,7 @@ typedef struct IDEState { EndTransferFunc *end_transfer_func; uint8_t *data_ptr; uint8_t *data_end; - uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4]; + uint8_t *io_buffer; QEMUTimer *sector_write_timer; /* only used for win2k install hack */ uint32_t irq_count; /* counts IRQs when using win2k install hack */ /* CF-ATA extended error */ @@ -2377,17 +2377,24 @@ struct partition { static int guess_disk_lchs(IDEState *s, int *pcylinders, int *pheads, int *psectors) { - uint8_t buf[512]; + uint8_t *buf; int ret, i, heads, sectors, cylinders; struct partition *p; uint32_t nr_sects; + buf = qemu_memalign(512, 512); + if (buf == NULL) + return -1; ret = bdrv_read(s->bs, 0, buf, 1); - if (ret < 0) + if (ret < 0) { + qemu_free(buf); return -1; + } /* test msdos magic */ - if (buf[510] != 0x55 || buf[511] != 0xaa) + if (buf[510] != 0x55 || buf[511] != 0xaa) { + qemu_free(buf); return -1; + } for(i = 0; i < 4; i++) { p = ((struct partition *)(buf + 0x1be)) + i; nr_sects = le32_to_cpu(p->nr_sects); @@ -2408,9 +2415,11 @@ static int guess_disk_lchs(IDEState *s, printf("guessed geometry: LCHS=%d %d %d\n", cylinders, heads, sectors); #endif + qemu_free(buf); return 0; } } + qemu_free(buf); return -1; } @@ -2425,6 +2434,7 @@ static void ide_init2(IDEState *ide_state, for(i = 0; i < 2; i++) { s = ide_state + i; + s->io_buffer = qemu_memalign(512, MAX_MULT_SECTORS*512 + 4); if (i == 0) s->bs = hd0; else |