Fixed MODE SELECT commands with either only block descriptor header or unexpected end of buffer, fixes Adaptec SCSI CD-ROM drivers for DOS.
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
* Implementation of the Iomega ZIP drive with SCSI(-like)
|
* Implementation of the Iomega ZIP drive with SCSI(-like)
|
||||||
* commands, for both ATAPI and SCSI usage.
|
* 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, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -2124,6 +2124,11 @@ zip_phase_data_out(scsi_common_t *sc)
|
|||||||
pos = hdr_len + block_desc_len;
|
pos = hdr_len + block_desc_len;
|
||||||
|
|
||||||
while(1) {
|
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 = dev->buffer[pos] & 0x3F;
|
||||||
page_len = dev->buffer[pos + 1];
|
page_len = dev->buffer[pos + 1];
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||||
* commands, for both ATAPI and SCSI usage.
|
* 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, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -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). */
|
/* Translates ATAPI phase (DRQ, I/O, C/D) to SCSI phase (MSG, C/D, I/O). */
|
||||||
int
|
int
|
||||||
scsi_cdrom_atapi_phase_to_scsi(scsi_cdrom_t *dev)
|
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;
|
pos = hdr_len + block_desc_len;
|
||||||
|
|
||||||
while(1) {
|
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 = dev->buffer[pos] & 0x3F;
|
||||||
page_len = dev->buffer[pos + 1];
|
page_len = dev->buffer[pos + 1];
|
||||||
|
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
||||||
if (!(scsi_cdrom_mode_sense_page_flags & (1LL << ((uint64_t) page)))) {
|
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;
|
error |= 1;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < page_len; i++) {
|
for (i = 0; i < page_len; i++) {
|
||||||
@@ -2443,7 +2435,7 @@ scsi_cdrom_phase_data_out(scsi_common_t *sc)
|
|||||||
if (ch)
|
if (ch)
|
||||||
dev->ms_pages_saved.pages[page][i + 2] = val;
|
dev->ms_pages_saved.pages[page][i + 2] = val;
|
||||||
else {
|
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;
|
error |= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of SCSI fixed disks.
|
* 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, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -1094,6 +1094,11 @@ scsi_disk_phase_data_out(scsi_common_t *sc)
|
|||||||
pos = hdr_len + block_desc_len;
|
pos = hdr_len + block_desc_len;
|
||||||
|
|
||||||
while(1) {
|
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 = dev->temp_buffer[pos] & 0x3F;
|
||||||
page_len = dev->temp_buffer[pos + 1];
|
page_len = dev->temp_buffer[pos + 1];
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
* series of SCSI Host Adapters made by Mylex.
|
* series of SCSI Host Adapters made by Mylex.
|
||||||
* These controllers were designed for various buses.
|
* 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, <mariogplayer@gmail.com>
|
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -55,6 +55,7 @@ static volatile
|
|||||||
x54x_t *x54x_dev;
|
x54x_t *x54x_dev;
|
||||||
|
|
||||||
|
|
||||||
|
#define ENABLE_X54X_LOG 1
|
||||||
#ifdef ENABLE_X54X_LOG
|
#ifdef ENABLE_X54X_LOG
|
||||||
int x54x_do_log = ENABLE_X54X_LOG;
|
int x54x_do_log = ENABLE_X54X_LOG;
|
||||||
|
|
||||||
@@ -65,7 +66,6 @@ x54x_log(const char *fmt, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (x54x_do_log) {
|
if (x54x_do_log) {
|
||||||
pclog("In %s mode: ",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real");
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
pclog_ex(fmt, ap);
|
pclog_ex(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
Reference in New Issue
Block a user