- new accesss mask must be checked in the i/o read/write register function.

This is necessary for devices with different i/o port masks.
- BX_MAX_IO_DEVICES increased to 30
- io_len mask fixed and unnecessary io_len checks removed in
  * biosdev.cc
  * cmos.cc
  * dma.cc
This commit is contained in:
Volker Ruppert 2003-07-31 15:29:34 +00:00
parent bcdcf42bdd
commit 37f3ea02b0
5 changed files with 33 additions and 45 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: biosdev.cc,v 1.5 2002-10-24 21:07:08 bdenney Exp $
// $Id: biosdev.cc,v 1.6 2003-07-31 15:29:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -96,16 +96,16 @@ bx_biosdev_c::~bx_biosdev_c(void)
void
bx_biosdev_c::init(void)
{
DEV_register_iowrite_handler(this, write_handler, 0x0400, "Bios Panic Port 1", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0401, "Bios Panic Port 2", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0403, "Bios Debug Port", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0402, "Bios Info Port", 7);
DEV_register_iowrite_handler(this, write_handler, 0xfff0, "Bios Info Port (legacy)", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0400, "Bios Panic Port 1", 3);
DEV_register_iowrite_handler(this, write_handler, 0x0401, "Bios Panic Port 2", 3);
DEV_register_iowrite_handler(this, write_handler, 0x0403, "Bios Debug Port", 1);
DEV_register_iowrite_handler(this, write_handler, 0x0402, "Bios Info Port", 1);
DEV_register_iowrite_handler(this, write_handler, 0xfff0, "Bios Info Port (legacy)", 1);
DEV_register_iowrite_handler(this, write_handler, 0x0501, "VGABios Panic Port 1", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0502, "VGABios Panic Port 2", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0503, "VGABios Debug Port", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0500, "VGABios Info Port", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0501, "VGABios Panic Port 1", 3);
DEV_register_iowrite_handler(this, write_handler, 0x0502, "VGABios Panic Port 2", 3);
DEV_register_iowrite_handler(this, write_handler, 0x0503, "VGABios Debug Port", 1);
DEV_register_iowrite_handler(this, write_handler, 0x0500, "VGABios Info Port", 1);
}
void

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cmos.cc,v 1.37 2003-04-25 21:48:11 cbothamy Exp $
// $Id: cmos.cc,v 1.38 2003-07-31 15:29:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -118,13 +118,13 @@ bx_cmos_c::~bx_cmos_c(void)
void
bx_cmos_c::init(void)
{
BX_DEBUG(("Init $Id: cmos.cc,v 1.37 2003-04-25 21:48:11 cbothamy Exp $"));
BX_DEBUG(("Init $Id: cmos.cc,v 1.38 2003-07-31 15:29:34 vruppert Exp $"));
// CMOS RAM & RTC
DEV_register_ioread_handler(this, read_handler, 0x0070, "CMOS RAM", 7);
DEV_register_ioread_handler(this, read_handler, 0x0071, "CMOS RAM", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0070, "CMOS RAM", 7);
DEV_register_iowrite_handler(this, write_handler, 0x0071, "CMOS RAM", 7);
DEV_register_ioread_handler(this, read_handler, 0x0070, "CMOS RAM", 1);
DEV_register_ioread_handler(this, read_handler, 0x0071, "CMOS RAM", 1);
DEV_register_iowrite_handler(this, write_handler, 0x0070, "CMOS RAM", 1);
DEV_register_iowrite_handler(this, write_handler, 0x0071, "CMOS RAM", 1);
DEV_register_irq(8, "CMOS RTC");
if (BX_CMOS_THIS s.periodic_timer_index == BX_NULL_TIMER_HANDLE) {
BX_CMOS_THIS s.periodic_timer_index =
@ -280,10 +280,6 @@ bx_cmos_c::read(Bit32u address, unsigned io_len)
#endif
Bit8u ret8;
if (io_len > 1)
BX_PANIC(("io read from address 0x%04x len=%u",
(unsigned) address, (unsigned) io_len));
if (bx_dbg.cmos)
BX_INFO(("CMOS read of CMOS register 0x%02x",
(unsigned) BX_CMOS_THIS s.cmos_mem_address));
@ -339,10 +335,6 @@ bx_cmos_c::write(Bit32u address, Bit32u value, unsigned io_len)
UNUSED(this_ptr);
#endif // !BX_USE_CMOS_SMF
if (io_len > 1)
BX_PANIC(("io write to address 0x%04x len=%u",
(unsigned) address, (unsigned) io_len));
if (bx_dbg.cmos)
BX_INFO(("CMOS write to address: 0x%04x = 0x%02x",
(unsigned) address, (unsigned) value));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: devices.cc,v 1.55 2003-07-31 12:04:48 vruppert Exp $
// $Id: devices.cc,v 1.56 2003-07-31 15:29:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -94,7 +94,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
{
unsigned i;
BX_DEBUG(("Init $Id: devices.cc,v 1.55 2003-07-31 12:04:48 vruppert Exp $"));
BX_DEBUG(("Init $Id: devices.cc,v 1.56 2003-07-31 15:29:34 vruppert Exp $"));
mem = newmem;
/* no read / write handlers defined */
@ -478,7 +478,8 @@ bx_devices_c::register_io_read_handler( void *this_ptr, bx_read_handler_t f,
/* first find existing handle for function or create new one */
for (handle=0; handle < num_read_handles; handle++) {
if (io_read_handler[handle].funct == f) break;
if ((io_read_handler[handle].funct == f) &&
(io_read_handler[handle].mask == mask)) break;
}
if (handle >= num_read_handles) {
@ -519,7 +520,8 @@ bx_devices_c::register_io_write_handler( void *this_ptr, bx_write_handler_t f,
/* first find existing handle for function or create new one */
for (handle=0; handle < num_write_handles; handle++) {
if (io_write_handler[handle].funct == f) break;
if ((io_write_handler[handle].funct == f) &&
(io_write_handler[handle].mask == mask)) break;
}
if (handle >= num_write_handles) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dma.cc,v 1.29 2003-05-03 07:41:27 vruppert Exp $
// $Id: dma.cc,v 1.30 2003-07-31 15:29:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -134,7 +134,7 @@ bx_dma_c::get_TC(void)
bx_dma_c::init(void)
{
unsigned c, i, j;
BX_DEBUG(("Init $Id: dma.cc,v 1.29 2003-05-03 07:41:27 vruppert Exp $"));
BX_DEBUG(("Init $Id: dma.cc,v 1.30 2003-07-31 15:29:34 vruppert Exp $"));
/* 8237 DMA controller */
@ -149,20 +149,20 @@ bx_dma_c::init(void)
// 0000..000F
for (i=0x0000; i<=0x000F; i++) {
DEV_register_ioread_handler(this, read_handler, i, "DMA controller", 7);
DEV_register_iowrite_handler(this, write_handler, i, "DMA controller", 7);
DEV_register_ioread_handler(this, read_handler, i, "DMA controller", 1);
DEV_register_iowrite_handler(this, write_handler, i, "DMA controller", 3);
}
// 00081..008F
for (i=0x0081; i<=0x008F; i++) {
DEV_register_ioread_handler(this, read_handler, i, "DMA controller", 7);
DEV_register_iowrite_handler(this, write_handler, i, "DMA controller", 7);
DEV_register_ioread_handler(this, read_handler, i, "DMA controller", 1);
DEV_register_iowrite_handler(this, write_handler, i, "DMA controller", 3);
}
// 000C0..00DE
for (i=0x00C0; i<=0x00DE; i+=2) {
DEV_register_ioread_handler(this, read_handler, i, "DMA controller", 7);
DEV_register_iowrite_handler(this, write_handler, i, "DMA controller", 7);
DEV_register_ioread_handler(this, read_handler, i, "DMA controller", 1);
DEV_register_iowrite_handler(this, write_handler, i, "DMA controller", 3);
}
@ -233,12 +233,6 @@ bx_dma_c::read( Bit32u address, unsigned io_len)
Bit8u channel;
bx_bool ma_sl;
if (io_len > 1) {
BX_ERROR(("io read from address %08x, len=%u",
(unsigned) address, (unsigned) io_len));
return 0xff;
}
BX_DEBUG(("read addr=%04x", (unsigned) address));
#if BX_DMA_FLOPPY_IO < 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: iodev.h,v 1.35 2003-07-31 12:04:48 vruppert Exp $
// $Id: iodev.h,v 1.36 2003-07-31 15:29:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -26,10 +26,10 @@
/* maximum number of emulated devices allowed. floppy, mda, etc...
/* maximum number of emulated devices allowed. floppy, vga, etc...
you can increase this to anything below 256 since an 8-bit handle
is used for each device */
#define BX_MAX_IO_DEVICES 21
#define BX_MAX_IO_DEVICES 30
/* the last device in the array is the "default" I/O device */
#define BX_DEFAULT_IO_DEVICE (BX_MAX_IO_DEVICES-1)