diff --git a/src/disk/zip.c b/src/disk/zip.c index f6701b71b..6447ecc37 100644 --- a/src/disk/zip.c +++ b/src/disk/zip.c @@ -9,7 +9,7 @@ * Implementation of the Iomega ZIP drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)zip.c 1.0.36 2018/10/31 + * Version: @(#)zip.c 1.0.37 2018/11/02 * * Author: Miran Grca, * @@ -2124,6 +2124,11 @@ zip_phase_data_out(scsi_common_t *sc) pos = hdr_len + block_desc_len; while(1) { + if (pos >= dev->current_cdb[4]) { + zip_log("ZIP %i: Buffer has only block descriptor\n", dev->id); + break; + } + page = dev->buffer[pos] & 0x3F; page_len = dev->buffer[pos + 1]; diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index ffd40ac5d..5dce001eb 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -9,7 +9,7 @@ * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)scsi_cdrom.c 1.0.67 2018/10/31 + * Version: @(#)scsi_cdrom.c 1.0.68 2018/11/02 * * Author: Miran Grca, * @@ -383,19 +383,6 @@ scsi_cdrom_current_mode(scsi_cdrom_t *dev) } -/* Translates ATAPI status (ERR_STAT flag) to SCSI status. */ -int -scsi_cdrom_err_stat_to_scsi(scsi_common_t *sc) -{ - scsi_cdrom_t *dev = (scsi_cdrom_t *) sc; - - if (dev->status & ERR_STAT) - return SCSI_STATUS_CHECK_CONDITION; - else - return SCSI_STATUS_OK; -} - - /* Translates ATAPI phase (DRQ, I/O, C/D) to SCSI phase (MSG, C/D, I/O). */ int scsi_cdrom_atapi_phase_to_scsi(scsi_cdrom_t *dev) @@ -2426,13 +2413,18 @@ scsi_cdrom_phase_data_out(scsi_common_t *sc) pos = hdr_len + block_desc_len; while(1) { + if (pos >= dev->current_cdb[4]) { + scsi_cdrom_log("CD-ROM %i: Buffer has only block descriptor\n", dev->id); + break; + } + page = dev->buffer[pos] & 0x3F; page_len = dev->buffer[pos + 1]; pos += 2; if (!(scsi_cdrom_mode_sense_page_flags & (1LL << ((uint64_t) page)))) { - scsi_cdrom_log("Unimplemented page %02X\n", page); + scsi_cdrom_log("CD-ROM %i: Unimplemented page %02X\n", dev->id, page); error |= 1; } else { for (i = 0; i < page_len; i++) { @@ -2443,7 +2435,7 @@ scsi_cdrom_phase_data_out(scsi_common_t *sc) if (ch) dev->ms_pages_saved.pages[page][i + 2] = val; else { - scsi_cdrom_log("Unchangeable value on position %02X on page %02X\n", i + 2, page); + scsi_cdrom_log("CD-ROM %i: Unchangeable value on position %02X on page %02X\n", dev->id, i + 2, page); error |= 1; } } diff --git a/src/scsi/scsi_disk.c b/src/scsi/scsi_disk.c index 24977a460..b15fc72fd 100644 --- a/src/scsi/scsi_disk.c +++ b/src/scsi/scsi_disk.c @@ -6,7 +6,7 @@ * * Emulation of SCSI fixed disks. * - * Version: @(#)scsi_disk.c 1.0.29 2018/10/31 + * Version: @(#)scsi_disk.c 1.0.30 2018/11/02 * * Author: Miran Grca, * @@ -1094,6 +1094,11 @@ scsi_disk_phase_data_out(scsi_common_t *sc) pos = hdr_len + block_desc_len; while(1) { + if (pos >= dev->current_cdb[4]) { + scsi_disk_log("SCSI HD %i: Buffer has only block descriptor\n", dev->id); + break; + } + page = dev->temp_buffer[pos] & 0x3F; page_len = dev->temp_buffer[pos + 1]; diff --git a/src/scsi/scsi_x54x.c b/src/scsi/scsi_x54x.c index a1c97f548..d6d21ae29 100644 --- a/src/scsi/scsi_x54x.c +++ b/src/scsi/scsi_x54x.c @@ -11,7 +11,7 @@ * series of SCSI Host Adapters made by Mylex. * These controllers were designed for various buses. * - * Version: @(#)scsi_x54x.c 1.0.26 2018/10/28 + * Version: @(#)scsi_x54x.c 1.0.27 2018/11/02 * * Authors: TheCollector1995, * Miran Grca, @@ -55,6 +55,7 @@ static volatile x54x_t *x54x_dev; +#define ENABLE_X54X_LOG 1 #ifdef ENABLE_X54X_LOG int x54x_do_log = ENABLE_X54X_LOG; @@ -65,7 +66,6 @@ x54x_log(const char *fmt, ...) va_list ap; if (x54x_do_log) { - pclog("In %s mode: ",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real"); va_start(ap, fmt); pclog_ex(fmt, ap); va_end(ap);