--- trunk/src/devices/dev_wdc.c 2007/10/08 16:19:37 22 +++ trunk/src/devices/dev_wdc.c 2007/10/08 16:19:56 24 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: dev_wdc.c,v 1.63 2006/02/18 13:15:21 debug Exp $ + * $Id: dev_wdc.c,v 1.66 2006/04/20 16:59:05 debug Exp $ * * Standard "wdc" IDE controller. */ @@ -588,15 +588,15 @@ } if (d->data_debug) { - char *s = "0x%04llx ]\n"; + char *s = "0x%04"PRIx64" ]\n"; if (len == 1) - s = "0x%02llx ]\n"; + s = "0x%02"PRIx64" ]\n"; if (len == 4) - s = "0x%08llx ]\n"; + s = "0x%08"PRIx64" ]\n"; if (len == 8) - s = "0x%016llx ]\n"; + s = "0x%016"PRIx64" ]\n"; debug("[ wdc: read from DATA: "); - debug(s, (long long)odata); + debug(s, (uint64_t) odata); } if (d->atapi_cmd_in_progress) { @@ -629,15 +629,15 @@ } else { int inbuf_len; if (d->data_debug) { - char *s = "0x%04llx ]\n"; + char *s = "0x%04"PRIx64" ]\n"; if (len == 1) - s = "0x%02llx ]\n"; + s = "0x%02"PRIx64" ]\n"; if (len == 4) - s = "0x%08llx ]\n"; + s = "0x%08"PRIx64" ]\n"; if (len == 8) - s = "0x%016llx ]\n"; + s = "0x%016"PRIx64" ]\n"; debug("[ wdc: write to DATA: "); - debug(s, (long long)idata); + debug(s, (uint64_t) idata); } if (!d->write_in_progress && !d->atapi_cmd_in_progress) { @@ -749,9 +749,14 @@ inbuf_len % 512 == 0) ) { int count = (d->write_in_progress == WDCC_WRITEMULTI)? d->write_count : 1; - unsigned char buf[512 * count]; + unsigned char *buf = malloc(512 * count); unsigned char *b = buf; + if (buf == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) { b = d->inbuf + d->inbuf_tail; d->inbuf_tail = (d->inbuf_tail + 512 @@ -772,6 +777,8 @@ if (d->write_count == 0) d->write_in_progress = 0; + + free(buf); } } break; @@ -968,7 +975,7 @@ tick_shift += 1; machine_add_tickfunction(devinit->machine, dev_wdc_tick, - d, tick_shift); + d, tick_shift, 0.0); return 1; }