Revision 33f00271 hw/ide.c
b/hw/ide.c | ||
---|---|---|
365 | 365 |
EndTransferFunc *end_transfer_func; |
366 | 366 |
uint8_t *data_ptr; |
367 | 367 |
uint8_t *data_end; |
368 |
uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
|
|
368 |
uint8_t *io_buffer;
|
|
369 | 369 |
QEMUTimer *sector_write_timer; /* only used for win2k install hack */ |
370 | 370 |
uint32_t irq_count; /* counts IRQs when using win2k install hack */ |
371 | 371 |
/* CF-ATA extended error */ |
... | ... | |
2377 | 2377 |
static int guess_disk_lchs(IDEState *s, |
2378 | 2378 |
int *pcylinders, int *pheads, int *psectors) |
2379 | 2379 |
{ |
2380 |
uint8_t buf[512];
|
|
2380 |
uint8_t *buf;
|
|
2381 | 2381 |
int ret, i, heads, sectors, cylinders; |
2382 | 2382 |
struct partition *p; |
2383 | 2383 |
uint32_t nr_sects; |
2384 | 2384 |
|
2385 |
buf = qemu_memalign(512, 512); |
|
2386 |
if (buf == NULL) |
|
2387 |
return -1; |
|
2385 | 2388 |
ret = bdrv_read(s->bs, 0, buf, 1); |
2386 |
if (ret < 0) |
|
2389 |
if (ret < 0) { |
|
2390 |
qemu_free(buf); |
|
2387 | 2391 |
return -1; |
2392 |
} |
|
2388 | 2393 |
/* test msdos magic */ |
2389 |
if (buf[510] != 0x55 || buf[511] != 0xaa) |
|
2394 |
if (buf[510] != 0x55 || buf[511] != 0xaa) { |
|
2395 |
qemu_free(buf); |
|
2390 | 2396 |
return -1; |
2397 |
} |
|
2391 | 2398 |
for(i = 0; i < 4; i++) { |
2392 | 2399 |
p = ((struct partition *)(buf + 0x1be)) + i; |
2393 | 2400 |
nr_sects = le32_to_cpu(p->nr_sects); |
... | ... | |
2408 | 2415 |
printf("guessed geometry: LCHS=%d %d %d\n", |
2409 | 2416 |
cylinders, heads, sectors); |
2410 | 2417 |
#endif |
2418 |
qemu_free(buf); |
|
2411 | 2419 |
return 0; |
2412 | 2420 |
} |
2413 | 2421 |
} |
2422 |
qemu_free(buf); |
|
2414 | 2423 |
return -1; |
2415 | 2424 |
} |
2416 | 2425 |
|
... | ... | |
2425 | 2434 |
|
2426 | 2435 |
for(i = 0; i < 2; i++) { |
2427 | 2436 |
s = ide_state + i; |
2437 |
s->io_buffer = qemu_memalign(512, MAX_MULT_SECTORS*512 + 4); |
|
2428 | 2438 |
if (i == 0) |
2429 | 2439 |
s->bs = hd0; |
2430 | 2440 |
else |
Also available in: Unified diff