More indent and C++ style changes (explicitly write virtual before virtual desctructors).

The PCI read/write handlers written in new C++ - more flexible and easy-to-understand
This commit is contained in:
Stanislav Shwartsman 2006-03-07 21:11:20 +00:00
parent 575a17e50f
commit 77653bcf3d
52 changed files with 626 additions and 1156 deletions

View File

@ -1,5 +1,5 @@
// $Id: biosdev.h,v 1.5 2006-03-07 18:16:40 sshwarts Exp $
// $Id: biosdev.h,v 1.6 2006-03-07 21:11:14 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -41,7 +41,7 @@
class bx_biosdev_c : public bx_devmodel_c {
public:
bx_biosdev_c();
~bx_biosdev_c();
virtual ~bx_biosdev_c();
virtual void init(void);
virtual void reset (unsigned type);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: busmouse.cc,v 1.2 2004-12-25 09:29:31 vruppert Exp $
// $Id: busmouse.cc,v 1.3 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -53,29 +53,25 @@ libbusmouse_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char
return(0); // Success
}
void
libbusmouse_LTX_plugin_fini(void)
void libbusmouse_LTX_plugin_fini(void)
{
BX_INFO (("busmouse plugin_fini"));
BX_INFO(("busmouse plugin_fini"));
}
bx_busm_c::bx_busm_c(void)
bx_busm_c::bx_busm_c()
{
// constructor
put("BUSM");
settype(BUSMLOG);
}
bx_busm_c::~bx_busm_c(void)
bx_busm_c::~bx_busm_c()
{
// destructor
BX_DEBUG(("Exit."));
}
void
bx_busm_c::init(void)
void bx_busm_c::init(void)
{
BX_DEBUG(("Init $Id: busmouse.cc,v 1.2 2004-12-25 09:29:31 vruppert Exp $"));
BX_DEBUG(("Init $Id: busmouse.cc,v 1.3 2006-03-07 21:11:16 sshwarts Exp $"));
DEV_register_irq(BUS_MOUSE_IRQ, "Bus Mouse");
@ -113,25 +109,20 @@ bx_busm_c::init(void)
BX_INFO(("Initialized BusMouse"));
}
void
bx_busm_c::reset(unsigned type)
void bx_busm_c::reset(unsigned type)
{
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_busm_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u bx_busm_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_BUSM_SMF
bx_busm_c *class_ptr = (bx_busm_c *) this_ptr;
return( class_ptr->read(address, io_len) );
return class_ptr->read(address, io_len);
}
Bit32u
bx_busm_c::read(Bit32u address, unsigned io_len)
Bit32u bx_busm_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -185,21 +176,17 @@ bx_busm_c::read(Bit32u address, unsigned io_len)
return value;
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_busm_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_busm_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_BUSM_SMF
bx_busm_c *class_ptr = (bx_busm_c *) this_ptr;
class_ptr->write(address, value, io_len);
}
void
bx_busm_c::write( Bit32u address, Bit32u value, unsigned io_len)
void bx_busm_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -264,8 +251,7 @@ bx_busm_c::write( Bit32u address, Bit32u value, unsigned io_len)
}
}
void
bx_busm_c::bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state)
void bx_busm_c::bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state)
{
// scale down the motion
if ( (delta_x < -1) || (delta_x > 1) )
@ -309,16 +295,14 @@ bx_busm_c::bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_
}
}
void
bx_busm_c::timer_handler(void *this_ptr)
void bx_busm_c::timer_handler(void *this_ptr)
{
bx_busm_c *class_ptr = (bx_busm_c *) this_ptr;
class_ptr->busm_timer();
}
// Called at 30hz
void
bx_busm_c::busm_timer(void)
void bx_busm_c::busm_timer(void)
{
// if interrupts are on, fire the interrupt
if (BX_BUSM_THIS interrupts) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: busmouse.h,v 1.2 2004-12-25 09:29:31 vruppert Exp $
// $Id: busmouse.h,v 1.3 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -48,12 +48,12 @@
class bx_busm_c : public bx_busm_stub_c {
public:
bx_busm_c(void);
~bx_busm_c(void);
bx_busm_c();
virtual ~bx_busm_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
virtual void init(void);
virtual void reset(unsigned type);
virtual void bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
private:
static void timer_handler(void *);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cdrom.h,v 1.19 2005-12-27 13:21:25 vruppert Exp $
// $Id: cdrom.h,v 1.20 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -31,7 +31,7 @@
class cdrom_interface : public logfunctions {
public:
cdrom_interface(char *dev);
~cdrom_interface(void);
virtual ~cdrom_interface(void);
void init(void);
// Load CD-ROM. Returns 0 if CD is not ready.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cmos.h,v 1.14 2006-03-07 18:16:40 sshwarts Exp $
// $Id: cmos.h,v 1.15 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -39,7 +39,7 @@
class bx_cmos_c : public bx_cmos_stub_c {
public:
bx_cmos_c();
~bx_cmos_c();
virtual ~bx_cmos_c();
virtual void init(void);
virtual void checksum_cmos(void);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dma.h,v 1.18 2006-03-07 18:16:40 sshwarts Exp $
// $Id: dma.h,v 1.19 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -40,7 +40,7 @@
class bx_dma_c : public bx_dma_stub_c {
public:
bx_dma_c();
~bx_dma_c();
virtual ~bx_dma_c();
virtual void init(void);
virtual void reset(unsigned type);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: eth.h,v 1.15 2004-10-07 17:38:03 vruppert Exp $
// $Id: eth.h,v 1.16 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -51,7 +51,7 @@ int execute_script(char *name, char* arg1);
class eth_pktmover_c {
public:
virtual void sendpkt(void *buf, unsigned io_len) = 0;
virtual ~eth_pktmover_c (void) {}
virtual ~eth_pktmover_c () {}
protected:
eth_rx_handler_t rxh; // receive callback
void *rxarg;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: extfpuirq.h,v 1.3 2006-03-07 18:16:40 sshwarts Exp $
// $Id: extfpuirq.h,v 1.4 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -40,7 +40,7 @@
class bx_extfpuirq_c : public bx_devmodel_c {
public:
bx_extfpuirq_c();
~bx_extfpuirq_c();
virtual ~bx_extfpuirq_c();
virtual void init(void);
virtual void reset(unsigned type);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.cc,v 1.95 2006-02-24 22:35:46 vruppert Exp $
// $Id: floppy.cc,v 1.96 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -110,8 +110,7 @@ static Bit16u drate_in_k[4] = {
};
int
libfloppy_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
int libfloppy_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
theFloppyController = new bx_floppy_ctrl_c ();
bx_devices.pluginFloppyDevice = theFloppyController;
@ -119,38 +118,32 @@ libfloppy_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *a
return(0); // Success
}
void
libfloppy_LTX_plugin_fini(void)
{
}
void libfloppy_LTX_plugin_fini(void) {}
bx_floppy_ctrl_c::bx_floppy_ctrl_c(void)
bx_floppy_ctrl_c::bx_floppy_ctrl_c()
{
put("FDD");
settype(FDLOG);
s.floppy_timer_index = BX_NULL_TIMER_HANDLE;
}
bx_floppy_ctrl_c::~bx_floppy_ctrl_c(void)
bx_floppy_ctrl_c::~bx_floppy_ctrl_c()
{
// nothing for now
BX_DEBUG(("Exit."));
}
void
bx_floppy_ctrl_c::init(void)
void bx_floppy_ctrl_c::init(void)
{
Bit8u i;
BX_DEBUG(("Init $Id: floppy.cc,v 1.95 2006-02-24 22:35:46 vruppert Exp $"));
BX_DEBUG(("Init $Id: floppy.cc,v 1.96 2006-03-07 21:11:16 sshwarts Exp $"));
DEV_dma_register_8bit_channel(2, dma_read, dma_write, "Floppy Drive");
DEV_register_irq(6, "Floppy Drive");
for (unsigned addr=0x03F2; addr<=0x03F7; addr++) {
DEV_register_ioread_handler(this, read_handler, addr, "Floppy Drive", 1);
DEV_register_iowrite_handler(this, write_handler, addr, "Floppy Drive", 1);
}
}
DEV_cmos_set_reg(0x10, 0x00); /* start out with: no drive 0, no drive 1 */
@ -338,10 +331,7 @@ bx_floppy_ctrl_c::init(void)
BX_FD_THIS s.non_dma = 0;
}
void
bx_floppy_ctrl_c::reset(unsigned type)
void bx_floppy_ctrl_c::reset(unsigned type)
{
Bit32u i;
@ -388,12 +378,10 @@ bx_floppy_ctrl_c::reset(unsigned type)
enter_idle_phase();
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_floppy_ctrl_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_floppy_ctrl_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_FD_SMF
bx_floppy_ctrl_c *class_ptr = (bx_floppy_ctrl_c *) this_ptr;
@ -401,10 +389,8 @@ bx_floppy_ctrl_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
return( class_ptr->read(address, io_len) );
}
/* reads from the floppy io ports */
Bit32u
bx_floppy_ctrl_c::read(Bit32u address, unsigned io_len)
/* reads from the floppy io ports */
Bit32u bx_floppy_ctrl_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -493,22 +479,18 @@ bx_floppy_ctrl_c::read(Bit32u address, unsigned io_len)
return (value);
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_floppy_ctrl_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_floppy_ctrl_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_FD_SMF
bx_floppy_ctrl_c *class_ptr = (bx_floppy_ctrl_c *) this_ptr;
class_ptr->write(address, value, io_len);
}
/* writes to the floppy io ports */
void
bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
/* writes to the floppy io ports */
void bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -697,10 +679,7 @@ bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
}
void
bx_floppy_ctrl_c::floppy_command(void)
void bx_floppy_ctrl_c::floppy_command(void)
{
#if BX_PROVIDE_CPU_MEMORY==0
BX_PANIC(("floppy_command(): uses DMA: not supported for"
@ -733,7 +712,6 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_ERROR(("non DMA mode not implemented yet"));
enter_idle_phase();
return;
break;
case 0x04: // get status
drive = (BX_FD_THIS s.command[1] & 0x03);
@ -743,7 +721,6 @@ bx_floppy_ctrl_c::floppy_command(void)
if (BX_FD_THIS s.cylinder[drive] == 0) BX_FD_THIS s.status_reg3 |= 0x10;
enter_result_phase();
return;
break;
case 0x07: // recalibrate
drive = (BX_FD_THIS s.command[1] & 0x03);
@ -762,7 +739,6 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.cylinder[drive] = 0;
BX_FD_THIS s.main_status_reg = (1 << drive);
return;
break;
case 0x08: /* sense interrupt status */
/* execution:
@ -783,7 +759,6 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_DEBUG(("sense interrupt status"));
enter_result_phase();
return;
break;
case 0x0f: /* seek */
/* command:
@ -807,7 +782,6 @@ bx_floppy_ctrl_c::floppy_command(void)
/* data reg not ready, drive busy */
BX_FD_THIS s.main_status_reg = (1 << drive);
return;
break;
case 0x13: // Configure
BX_DEBUG(("configure (eis = 0x%02x)", BX_FD_THIS s.command[2] & 0x40 ));
@ -819,7 +793,6 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.pretrk = BX_FD_THIS s.command[3];
enter_idle_phase();
return;
break;
case 0x4a: // read ID
drive = BX_FD_THIS s.command[1] & 0x03;
@ -850,7 +823,6 @@ bx_floppy_ctrl_c::floppy_command(void)
/* data reg not ready, controller busy */
BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
return;
break;
case 0x4d: // format track
drive = BX_FD_THIS s.command[1] & 0x03;
@ -869,15 +841,15 @@ bx_floppy_ctrl_c::floppy_command(void)
if (sector_size != 0x02) { // 512 bytes
BX_PANIC(("format track: sector size %d not supported", 128<<sector_size));
}
}
if (BX_FD_THIS s.format_count != BX_FD_THIS s.media[drive].sectors_per_track) {
BX_PANIC(("format track: %d sectors/track requested (%d expected)",
BX_FD_THIS s.format_count, BX_FD_THIS s.media[drive].sectors_per_track));
}
if ( BX_FD_THIS s.media_present[drive] == 0 ) {
}
if (BX_FD_THIS s.media_present[drive] == 0) {
BX_INFO(("attempt to format track with media not present"));
return; // Hang controller
}
}
if (BX_FD_THIS s.media[drive].write_protected) {
// media write-protected, return error
BX_INFO(("attempt to format track with media write-protected"));
@ -886,7 +858,7 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.status_reg2 = 0x31; // 0011 0001
enter_result_phase();
return;
}
}
/* 4 header bytes per sector are required */
BX_FD_THIS s.format_count <<= 2;
@ -897,7 +869,6 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
BX_DEBUG(("format track"));
return;
break;
case 0x46: // read normal data, MT=0, SK=0
case 0x66: // read normal data, MT=0, SK=1
@ -947,11 +918,11 @@ bx_floppy_ctrl_c::floppy_command(void)
if ( BX_FD_THIS s.media_present[drive] == 0 ) {
BX_INFO(("attempt to read/write sector %u with media not present", (unsigned) sector));
return; // Hang controller
}
}
if (sector_size != 0x02) { // 512 bytes
BX_PANIC(("read/write command: sector size %d not supported", 128<<sector_size));
}
}
if ( cylinder >= BX_FD_THIS s.media[drive].tracks ) {
BX_PANIC(("io: norm r/w parms out of range: sec#%02xh cyl#%02xh eot#%02xh head#%02xh",
@ -1028,8 +999,7 @@ bx_floppy_ctrl_c::floppy_command(void)
#endif
}
void
bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
void bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
Bit32u bytes, Bit8u direction)
{
int ret = 0;
@ -1042,21 +1012,21 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
BX_INFO(("offset=%u", (unsigned) offset));
BX_INFO(("bytes=%u", (unsigned) bytes));
BX_INFO(("direction=%s", (direction==FROM_FLOPPY)? "from" : "to"));
}
}
#if BX_WITH_MACOS
if (strcmp(SIM->get_param_string(BXPN_FLOPPYA_PATH)->getptr(), SuperDrive))
#endif
{
// don't need to seek the file if we are using Win95 type direct access
if (!BX_FD_THIS s.media[drive].raw_floppy_win95) {
ret = (int)lseek(BX_FD_THIS s.media[drive].fd, offset, SEEK_SET);
if (ret < 0) {
BX_PANIC(("could not perform lseek() to %d on floppy image file", offset));
return;
}
{
// don't need to seek the file if we are using Win95 type direct access
if (!BX_FD_THIS s.media[drive].raw_floppy_win95) {
ret = (int)lseek(BX_FD_THIS s.media[drive].fd, offset, SEEK_SET);
if (ret < 0) {
BX_PANIC(("could not perform lseek() to %d on floppy image file", offset));
return;
}
}
}
if (direction == FROM_FLOPPY) {
#if BX_WITH_MACOS
@ -1094,13 +1064,13 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
BX_INFO(("partial read() on floppy image returns %u/%u",
(unsigned) ret, (unsigned) bytes));
memset(buffer + ret, 0, bytes - ret);
}
}
else {
BX_INFO(("read() on floppy image returns 0"));
memset(buffer, 0, bytes);
}
}
}
}
else { // TO_FLOPPY
BX_ASSERT (!BX_FD_THIS s.media[drive].write_protected);
@ -1139,24 +1109,18 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
}
}
void
bx_floppy_ctrl_c::timer_handler(void *this_ptr)
void bx_floppy_ctrl_c::timer_handler(void *this_ptr)
{
bx_floppy_ctrl_c *class_ptr = (bx_floppy_ctrl_c *) this_ptr;
class_ptr->timer();
}
void
bx_floppy_ctrl_c::timer()
void bx_floppy_ctrl_c::timer()
{
Bit8u drive, motor_on;
drive = BX_FD_THIS s.DOR & 0x03;
switch ( BX_FD_THIS s.pending_command ) {
switch (BX_FD_THIS s.pending_command) {
case 0x07: // recal
BX_FD_THIS s.status_reg0 = 0x20 | drive;
motor_on = ((BX_FD_THIS s.DOR>>(drive+4)) & 0x01);
@ -1236,14 +1200,12 @@ bx_floppy_ctrl_c::timer()
}
}
void
bx_floppy_ctrl_c::dma_write(Bit8u *data_byte)
void bx_floppy_ctrl_c::dma_write(Bit8u *data_byte)
{
// A DMA write is from I/O to Memory
// We need to return then next data byte from the floppy buffer
// to be transfered via the DMA to memory. (read block from floppy)
*data_byte = BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index++];
if (BX_FD_THIS s.floppy_buffer_index >= 512) {
@ -1289,8 +1251,7 @@ bx_floppy_ctrl_c::dma_write(Bit8u *data_byte)
}
}
void
bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
void bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
{
// A DMA read is from Memory to I/O
// We need to write the data_byte which was already transfered from memory
@ -1366,16 +1327,14 @@ bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
}
}
void
bx_floppy_ctrl_c::raise_interrupt(void)
void bx_floppy_ctrl_c::raise_interrupt(void)
{
DEV_pic_raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
BX_FD_THIS s.reset_sensei = 0;
}
void
bx_floppy_ctrl_c::lower_interrupt(void)
void bx_floppy_ctrl_c::lower_interrupt(void)
{
if (BX_FD_THIS s.pending_irq) {
DEV_pic_lower_irq(6);
@ -1383,9 +1342,7 @@ bx_floppy_ctrl_c::lower_interrupt(void)
}
}
void
bx_floppy_ctrl_c::increment_sector(void)
void bx_floppy_ctrl_c::increment_sector(void)
{
Bit8u drive;
@ -1417,8 +1374,7 @@ bx_floppy_ctrl_c::increment_sector(void)
}
}
unsigned
bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
unsigned bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
{
char *path;
unsigned type;
@ -1486,10 +1442,9 @@ bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
}
}
unsigned
bx_floppy_ctrl_c::get_media_status(unsigned drive)
unsigned bx_floppy_ctrl_c::get_media_status(unsigned drive)
{
return( BX_FD_THIS s.media_present[drive] );
return BX_FD_THIS s.media_present[drive];
}
#ifdef O_BINARY
@ -1500,8 +1455,7 @@ bx_floppy_ctrl_c::get_media_status(unsigned drive)
#define BX_RDWR O_RDWR
#endif
bx_bool
bx_floppy_ctrl_c::evaluate_media(Bit8u devtype, Bit8u type, char *path, floppy_t *media)
bx_bool bx_floppy_ctrl_c::evaluate_media(Bit8u devtype, Bit8u type, char *path, floppy_t *media)
{
struct stat stat_buf;
int i, ret;
@ -1652,7 +1606,7 @@ bx_floppy_ctrl_c::evaluate_media(Bit8u devtype, Bit8u type, char *path, floppy_t
if (ret) {
BX_PANIC(("fstat floppy 0 drive image file returns error: %s", strerror(errno)));
return(0);
}
}
if ( S_ISREG(stat_buf.st_mode) ) {
// regular file
@ -1709,9 +1663,9 @@ bx_floppy_ctrl_c::evaluate_media(Bit8u devtype, Bit8u type, char *path, floppy_t
return 0;
}
media->sectors = media->heads * media->tracks * media->sectors_per_track;
}
return(1); // success
}
return(1); // success
}
else if ( S_ISCHR(stat_buf.st_mode)
#if BX_WITH_MACOS == 0
@ -1755,9 +1709,7 @@ bx_floppy_ctrl_c::evaluate_media(Bit8u devtype, Bit8u type, char *path, floppy_t
}
}
void
bx_floppy_ctrl_c::enter_result_phase(void)
void bx_floppy_ctrl_c::enter_result_phase(void)
{
Bit8u drive;
unsigned i;
@ -1837,8 +1789,7 @@ bx_floppy_ctrl_c::enter_result_phase(void)
BX_DEBUG((buf));
}
void
bx_floppy_ctrl_c::enter_idle_phase(void)
void bx_floppy_ctrl_c::enter_idle_phase(void)
{
BX_FD_THIS s.main_status_reg &= 0x0f; // leave drive status untouched
BX_FD_THIS s.main_status_reg |= FD_MS_MRQ; // data register ready

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.h,v 1.27 2006-03-07 18:16:40 sshwarts Exp $
// $Id: floppy.h,v 1.28 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -54,11 +54,10 @@ typedef struct {
class bx_floppy_ctrl_c : public bx_floppy_stub_c {
public:
bx_floppy_ctrl_c(void);
~bx_floppy_ctrl_c(void);
virtual void init(void);
virtual void reset(unsigned type);
bx_floppy_ctrl_c();
virtual ~bx_floppy_ctrl_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual unsigned set_media_status(unsigned drive, unsigned status);
virtual unsigned get_media_status(unsigned drive);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gameport.h,v 1.2 2006-03-07 18:16:40 sshwarts Exp $
// $Id: gameport.h,v 1.3 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003 MandrakeSoft S.A.
@ -39,9 +39,9 @@
class bx_gameport_c : public bx_devmodel_c {
public:
bx_gameport_c();
~bx_gameport_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual ~bx_gameport_c();
virtual void init(void);
virtual void reset(unsigned type);
private:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: guest2host.h,v 1.9 2006-03-07 18:16:40 sshwarts Exp $
// $Id: guest2host.h,v 1.10 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -43,7 +43,7 @@ typedef void (*bx_g2h_callback_t)(bx_guest_packet_t *);
class bx_g2h_c : public logfunctions {
public:
bx_g2h_c();
~bx_g2h_c();
virtual ~bx_g2h_c();
static void init(void);
void reset(unsigned type);
unsigned acquire_channel(bx_g2h_callback_t);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ioapic.h,v 1.19 2006-03-06 22:03:16 sshwarts Exp $
// $Id: ioapic.h,v 1.20 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -83,8 +83,8 @@ class bx_ioapic_c : public bx_generic_apic_c
public:
bx_io_redirect_entry_t ioredtbl[BX_IOAPIC_NUM_PINS]; // table of redirections
bx_ioapic_c ();
~bx_ioapic_c ();
bx_ioapic_c();
virtual ~bx_ioapic_c();
virtual void init();
virtual void reset(unsigned type) {}
virtual void read_aligned(bx_phy_address address, Bit32u *data, unsigned len);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: iodebug.h,v 1.8 2006-03-03 12:55:37 sshwarts Exp $
// $Id: iodebug.h,v 1.9 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
#ifndef _BX_IODEBUG_H
@ -14,7 +14,7 @@
class bx_iodebug_c : public bx_devmodel_c {
public:
bx_iodebug_c();
~bx_iodebug_c() {}
virtual ~bx_iodebug_c() {}
virtual void init(void);
virtual void reset (unsigned type) {}
static void mem_write( BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: iodev.h,v 1.71 2006-03-07 18:16:40 sshwarts Exp $
// $Id: iodev.h,v 1.72 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -81,7 +81,7 @@ typedef void (*bx_write_handler_t)(void *, Bit32u, Bit32u, unsigned);
// virtual (= 0).
class BOCHSAPI bx_devmodel_c : public logfunctions {
public:
virtual ~bx_devmodel_c () {}
virtual ~bx_devmodel_c() {}
virtual void init_mem(BX_MEM_C *) {}
virtual void init(void) {}
virtual void reset(unsigned type) {}
@ -89,16 +89,35 @@ class BOCHSAPI bx_devmodel_c : public logfunctions {
virtual void device_save_state () {}
};
//////////////////////////////////////////////////////////////////////
// declare stubs for PCI devices
//////////////////////////////////////////////////////////////////////
// the best should be deriving of bx_pci_device_stub_c from bx_devmodel_c
// but it make serious problems for cirrus_svga device
class BOCHSAPI bx_pci_device_stub_c {
public:
virtual ~bx_pci_device_stub_c() {}
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len) {
return 0;
}
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len) {}
};
//////////////////////////////////////////////////////////////////////
// declare stubs for devices
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
#define STUBFUNC(dev,method) \
pluginlog->panic("%s called in %s stub. you must not have loaded the %s plugin", #dev, #method, #dev )
//////////////////////////////////////////////////////////////////////
class BOCHSAPI bx_keyb_stub_c : public bx_devmodel_c {
public:
virtual ~bx_keyb_stub_c () {}
public:
virtual ~bx_keyb_stub_c() {}
// stubs for bx_keyb_c methods
virtual void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state) {
STUBFUNC(keyboard, mouse_motion);
@ -112,7 +131,7 @@ class BOCHSAPI bx_keyb_stub_c : public bx_devmodel_c {
};
class BOCHSAPI bx_hard_drive_stub_c : public bx_devmodel_c {
public:
public:
virtual void close_harddrive(void) {
STUBFUNC(HD, close_harddrive);
}
@ -155,7 +174,7 @@ class BOCHSAPI bx_hard_drive_stub_c : public bx_devmodel_c {
};
class BOCHSAPI bx_floppy_stub_c : public bx_devmodel_c {
public:
public:
virtual unsigned get_media_status(unsigned drive) {
STUBFUNC(floppy, get_media_status); return 0;
}
@ -165,7 +184,7 @@ class BOCHSAPI bx_floppy_stub_c : public bx_devmodel_c {
};
class BOCHSAPI bx_cmos_stub_c : public bx_devmodel_c {
public:
public:
virtual Bit32u get_reg(unsigned reg) {
STUBFUNC(cmos, get_reg); return 0;
}
@ -184,21 +203,21 @@ class BOCHSAPI bx_cmos_stub_c : public bx_devmodel_c {
};
class BOCHSAPI bx_dma_stub_c : public bx_devmodel_c {
public:
public:
virtual unsigned registerDMA8Channel(
unsigned channel,
void (* dmaRead)(Bit8u *data_byte),
void (* dmaWrite)(Bit8u *data_byte),
const char *name
) {
const char *name)
{
STUBFUNC(dma, registerDMA8Channel); return 0;
}
virtual unsigned registerDMA16Channel(
unsigned channel,
void (* dmaRead)(Bit16u *data_word),
void (* dmaWrite)(Bit16u *data_word),
const char *name
) {
const char *name)
{
STUBFUNC(dma, registerDMA16Channel); return 0;
}
virtual unsigned unregisterDMAChannel(unsigned channel) {
@ -216,7 +235,7 @@ class BOCHSAPI bx_dma_stub_c : public bx_devmodel_c {
};
class BOCHSAPI bx_pic_stub_c : public bx_devmodel_c {
public:
public:
virtual void raise_irq(unsigned irq_no) {
STUBFUNC(pic, raise_irq);
}
@ -235,7 +254,7 @@ class BOCHSAPI bx_pic_stub_c : public bx_devmodel_c {
};
class BOCHSAPI bx_vga_stub_c : public bx_devmodel_c {
public:
public:
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height) {
STUBFUNC(vga, redraw_area);
@ -259,13 +278,12 @@ class BOCHSAPI bx_vga_stub_c : public bx_devmodel_c {
virtual void dump_status(void) {}
};
class BOCHSAPI bx_pci_bridge_stub_c : public bx_devmodel_c {
class BOCHSAPI bx_pci_bridge_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
public:
virtual bx_bool register_pci_handlers(void *this_ptr,
Bit32u (*bx_pci_read_handler)(void *, Bit8u, unsigned),
void(*bx_pci_write_handler)(void *, Bit8u, Bit32u, unsigned),
virtual bx_bool register_pci_handlers(bx_pci_device_stub_c *device,
Bit8u *devfunc, const char *name,
const char *descr) {
const char *descr)
{
STUBFUNC(pci, register_pci_handlers); return 0;
}
virtual bx_bool is_pci_device (const char *name) {
@ -293,42 +311,42 @@ public:
virtual void print_i440fx_state(void) {}
};
class BOCHSAPI bx_pci2isa_stub_c : public bx_devmodel_c {
public:
class BOCHSAPI bx_pci2isa_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
public:
virtual void pci_set_irq (Bit8u devfunc, unsigned line, bx_bool level) {
STUBFUNC(pci2isa, pci_set_irq);
}
};
class BOCHSAPI bx_pci_ide_stub_c : public bx_devmodel_c {
public:
class BOCHSAPI bx_pci_ide_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
public:
virtual bx_bool bmdma_present(void) {
return 0;
}
virtual void bmdma_set_irq(Bit8u channel) {}
};
class BOCHSAPI bx_ne2k_stub_c : public bx_devmodel_c {
public:
class BOCHSAPI bx_ne2k_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
public:
virtual void print_info(FILE *file, int page, int reg, int nodups) {}
};
class BOCHSAPI bx_speaker_stub_c : public bx_devmodel_c {
public:
public:
virtual void beep_on(float frequency) {}
virtual void beep_off() {}
};
class BOCHSAPI bx_serial_stub_c : public bx_devmodel_c {
public:
public:
virtual void serial_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state) {
STUBFUNC(serial, serial_mouse_enq);
}
};
#if BX_SUPPORT_PCIUSB
class BOCHSAPI bx_usb_stub_c : public bx_devmodel_c {
public:
class BOCHSAPI bx_pci_usb_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
public:
virtual void usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state) {
STUBFUNC(pciusb, usb_mouse_enq);
}
@ -350,7 +368,7 @@ class BOCHSAPI bx_usb_stub_c : public bx_devmodel_c {
#if BX_SUPPORT_BUSMOUSE
class BOCHSAPI bx_busm_stub_c : public bx_devmodel_c {
public:
public:
virtual void bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state) {
STUBFUNC(busmouse, bus_mouse_enq);
}
@ -360,7 +378,7 @@ class BOCHSAPI bx_busm_stub_c : public bx_devmodel_c {
class BOCHSAPI bx_devices_c : public logfunctions {
public:
bx_devices_c(void);
~bx_devices_c(void);
~bx_devices_c(void);
// Register I/O addresses and IRQ lines. Initialize any internal
// structures. init() is called only once, even if the simulator
// reboots or is restarted.
@ -415,7 +433,7 @@ public:
bx_cmos_stub_c *pluginCmosDevice;
bx_serial_stub_c *pluginSerialDevice;
#if BX_SUPPORT_PCIUSB
bx_usb_stub_c *pluginPciUSBAdapter;
bx_pci_usb_stub_c *pluginPciUSBAdapter;
#endif
bx_devmodel_c *pluginParallelDevice;
bx_devmodel_c *pluginUnmapped;
@ -456,7 +474,7 @@ public:
bx_speaker_stub_c stubSpeaker;
bx_serial_stub_c stubSerial;
#if BX_SUPPORT_PCIUSB
bx_usb_stub_c stubUsbAdapter;
bx_pci_usb_stub_c stubUsbAdapter;
#endif
// Some info to pass to devices which can handled bulk IO. This allows

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.cc,v 1.112 2006-03-07 17:54:27 vruppert Exp $
// $Id: keyboard.cc,v 1.113 2006-03-07 21:11:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -62,8 +62,7 @@
bx_keyb_c *theKeyboard = NULL;
int
libkeyboard_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
int libkeyboard_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
// Create one instance of the keyboard device object.
theKeyboard = new bx_keyb_c ();
@ -75,34 +74,22 @@ libkeyboard_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char
return(0); // Success
}
void
libkeyboard_LTX_plugin_fini(void)
void libkeyboard_LTX_plugin_fini(void)
{
BX_INFO (("keyboard plugin_fini"));
}
bx_keyb_c::bx_keyb_c(void)
bx_keyb_c::bx_keyb_c()
{
// constructor
put("KBD");
settype(KBDLOG);
}
bx_keyb_c::~bx_keyb_c(void)
{
// destructor
BX_DEBUG(("Exit."));
}
// flush internal buffer and reset keyboard settings to power-up condition
void
bx_keyb_c::resetinternals(bx_bool powerup)
void bx_keyb_c::resetinternals(bx_bool powerup)
{
Bit32u i;
BX_KEY_THIS s.kbd_internal_buffer.num_elements = 0;
for (i=0; i<BX_KBD_ELEMENTS; i++)
for (int i=0; i<BX_KBD_ELEMENTS; i++)
BX_KEY_THIS s.kbd_internal_buffer.buffer[i] = 0;
BX_KEY_THIS s.kbd_internal_buffer.head = 0;
@ -120,12 +107,9 @@ bx_keyb_c::resetinternals(bx_bool powerup)
}
}
void
bx_keyb_c::init(void)
void bx_keyb_c::init(void)
{
BX_DEBUG(("Init $Id: keyboard.cc,v 1.112 2006-03-07 17:54:27 vruppert Exp $"));
BX_DEBUG(("Init $Id: keyboard.cc,v 1.113 2006-03-07 21:11:16 sshwarts Exp $"));
Bit32u i;
DEV_register_irq(1, "8042 Keyboard controller");
@ -260,8 +244,7 @@ bx_keyb_c::init(void)
SIM->get_param_num(BXPN_KBD_PASTE_DELAY)->set_runtime_param(1);
}
void
bx_keyb_c::reset(unsigned type)
void bx_keyb_c::reset(unsigned type)
{
if (BX_KEY_THIS pastebuf != NULL) {
BX_KEY_THIS stop_paste = 1;
@ -285,15 +268,14 @@ Bit64s bx_keyb_c::kbd_param_handler(bx_param_c *param, int set, Bit64s val)
return val;
}
void
bx_keyb_c::paste_delay_changed(Bit32u value)
void bx_keyb_c::paste_delay_changed(Bit32u value)
{
BX_KEY_THIS pastedelay = value / BX_IODEV_HANDLER_PERIOD;
BX_INFO(("will paste characters every %d keyboard ticks",BX_KEY_THIS pastedelay));
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// read function - the big picture:
// if address == data port then
@ -302,8 +284,7 @@ bx_keyb_c::paste_delay_changed(Bit32u value)
// else address== status port
// assemble the status bits and return them.
//
Bit32u
bx_keyb_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_keyb_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_KEY_SMF
bx_keyb_c *class_ptr = (bx_keyb_c *) this_ptr;
@ -311,9 +292,7 @@ bx_keyb_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
return( class_ptr->read(address, io_len) );
}
Bit32u
bx_keyb_c::read(Bit32u address, unsigned io_len)
Bit32u bx_keyb_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -338,15 +317,15 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
for (i=0; i<BX_KEY_THIS s.controller_Qsize-1; i++) {
// move Q elements towards head of queue by one
BX_KEY_THIS s.controller_Q[i] = BX_KEY_THIS s.controller_Q[i+1];
}
BX_KEY_THIS s.controller_Qsize--;
}
BX_KEY_THIS s.controller_Qsize--;
}
DEV_pic_lower_irq(12);
activate_timer();
BX_DEBUG(("[mouse] read from 0x%02x returns 0x%02x", address, val));
return val;
}
}
else if (BX_KEY_THIS s.kbd_controller.outb) { /* kbd byte available */
val = BX_KEY_THIS s.kbd_controller.kbd_output_buffer;
BX_KEY_THIS s.kbd_controller.outb = 0;
@ -364,27 +343,25 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
for (i=0; i<BX_KEY_THIS s.controller_Qsize-1; i++) {
// move Q elements towards head of queue by one
BX_KEY_THIS s.controller_Q[i] = BX_KEY_THIS s.controller_Q[i+1];
}
}
BX_DEBUG(("s.controller_Qsize: %02X",BX_KEY_THIS s.controller_Qsize));
BX_KEY_THIS s.controller_Qsize--;
}
}
DEV_pic_lower_irq(1);
activate_timer();
BX_DEBUG(("READ(%02x) = %02x", (unsigned) address,
(unsigned) val));
BX_DEBUG(("READ(%02x) = %02x", (unsigned) address, (unsigned) val));
return val;
}
}
else {
BX_DEBUG(("num_elements = %d", BX_KEY_THIS s.kbd_internal_buffer.num_elements));
BX_DEBUG(("read from port 60h with outb empty"));
return BX_KEY_THIS s.kbd_controller.kbd_output_buffer;
}
}
}
#if BX_CPU_LEVEL >= 2
else if (address == 0x64) { /* status register */
val = (BX_KEY_THIS s.kbd_controller.pare << 7) |
(BX_KEY_THIS s.kbd_controller.tim << 6) |
(BX_KEY_THIS s.kbd_controller.auxb << 5) |
@ -395,14 +372,14 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
BX_KEY_THIS s.kbd_controller.outb;
BX_KEY_THIS s.kbd_controller.tim = 0;
return val;
}
}
#else /* BX_CPU_LEVEL > 0 */
/* XT MODE, System 8255 Mode Register */
else if (address == 0x64) { /* status register */
BX_DEBUG(("IO read from port 64h, system 8255 mode register"));
return BX_KEY_THIS s.kbd_controller.outb;
}
}
#endif /* BX_CPU_LEVEL > 0 */
BX_PANIC(("unknown address in io read to keyboard port %x",
@ -410,21 +387,17 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
return 0; /* keep compiler happy */
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_keyb_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_keyb_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_KEY_SMF
bx_keyb_c *class_ptr = (bx_keyb_c *) this_ptr;
class_ptr->write(address, value, io_len);
}
void
bx_keyb_c::write( Bit32u address, Bit32u value, unsigned io_len)
void bx_keyb_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -443,7 +416,7 @@ bx_keyb_c::write( Bit32u address, Bit32u value, unsigned io_len)
BX_KEY_THIS s.kbd_controller.c_d = 0;
if (BX_KEY_THIS s.kbd_controller.inpb) {
BX_PANIC(("write to port 60h, not ready for write"));
}
}
switch (BX_KEY_THIS s.kbd_controller.last_comm) {
case 0x60: // write command byte
{
@ -691,8 +664,7 @@ bx_keyb_c::write( Bit32u address, Bit32u value, unsigned io_len)
// we have to be conservative. Note that this process depends on the
// keymap tables to know what chars correspond to what keys, and which
// chars require a shift or other modifier.
void
bx_keyb_c::service_paste_buf ()
void bx_keyb_c::service_paste_buf()
{
if (!BX_KEY_THIS pastebuf) return;
BX_DEBUG (("service_paste_buf: ptr at %d out of %d", BX_KEY_THIS pastebuf_ptr, BX_KEY_THIS pastebuf_len));
@ -728,8 +700,7 @@ bx_keyb_c::service_paste_buf ()
// paste which is still in progress will be thrown out. BYTES is a pointer
// to a region of memory containing the chars to be pasted. When the paste
// is complete, the keyboard code will call delete [] bytes;
void
bx_keyb_c::paste_bytes (Bit8u *bytes, Bit32s length)
void bx_keyb_c::paste_bytes (Bit8u *bytes, Bit32s length)
{
BX_DEBUG (("paste_bytes: %d bytes", length));
if (BX_KEY_THIS pastebuf) {
@ -743,8 +714,7 @@ bx_keyb_c::paste_bytes (Bit8u *bytes, Bit32s length)
BX_KEY_THIS service_paste_buf ();
}
void
bx_keyb_c::gen_scancode(Bit32u key)
void bx_keyb_c::gen_scancode(Bit32u key)
{
unsigned char *scancode;
Bit8u i;
@ -775,7 +745,6 @@ bx_keyb_c::gen_scancode(Bit32u key)
}
#endif
if (BX_KEY_THIS s.kbd_controller.scancodes_translate) {
// Translate before send
Bit8u escaped=0x00;
@ -819,10 +788,7 @@ bx_keyb_c::set_kbd_clock_enable(Bit8u value)
}
}
void
bx_keyb_c::set_aux_clock_enable(Bit8u value)
void bx_keyb_c::set_aux_clock_enable(Bit8u value)
{
bx_bool prev_aux_clock_enabled;
@ -838,8 +804,7 @@ bx_keyb_c::set_aux_clock_enable(Bit8u value)
}
}
Bit8u
bx_keyb_c::get_kbd_enable(void)
Bit8u bx_keyb_c::get_kbd_enable(void)
{
BX_DEBUG(("get_kbd_enable(): getting kbd_clock_enabled of: %02x",
(unsigned) BX_KEY_THIS s.kbd_controller.kbd_clock_enabled));
@ -847,8 +812,7 @@ bx_keyb_c::get_kbd_enable(void)
return(BX_KEY_THIS s.kbd_controller.kbd_clock_enabled);
}
void
bx_keyb_c::controller_enQ(Bit8u data, unsigned source)
void bx_keyb_c::controller_enQ(Bit8u data, unsigned source)
{
// source is 0 for keyboard, 1 for mouse
@ -882,8 +846,7 @@ bx_keyb_c::controller_enQ(Bit8u data, unsigned source)
}
}
void
bx_keyb_c::kbd_enQ_imm(Bit8u val)
void bx_keyb_c::kbd_enQ_imm(Bit8u val)
{
int tail;
@ -903,9 +866,7 @@ bx_keyb_c::kbd_enQ_imm(Bit8u val)
BX_KEY_THIS s.kbd_controller.irq1_requested = 1;
}
void
bx_keyb_c::kbd_enQ(Bit8u scancode)
void bx_keyb_c::kbd_enQ(Bit8u scancode)
{
int tail;
@ -932,8 +893,7 @@ bx_keyb_c::kbd_enQ(Bit8u scancode)
}
}
bx_bool
bx_keyb_c::mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3, Bit8u b4)
bx_bool bx_keyb_c::mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3, Bit8u b4)
{
int bytes = 3;
if (BX_KEY_THIS s.mouse.im_mode) bytes = 4;
@ -950,9 +910,7 @@ bx_keyb_c::mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3, Bit8u b4)
return(1);
}
void
bx_keyb_c::mouse_enQ(Bit8u mouse_data)
void bx_keyb_c::mouse_enQ(Bit8u mouse_data)
{
int tail;
@ -976,8 +934,7 @@ bx_keyb_c::mouse_enQ(Bit8u mouse_data)
}
}
void
bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
void bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
{
BX_DEBUG(("controller passed byte %02xh to keyboard", value));
@ -1131,8 +1088,7 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
}
}
void
bx_keyb_c::timer_handler(void *this_ptr)
void bx_keyb_c::timer_handler(void *this_ptr)
{
bx_keyb_c *class_ptr = (bx_keyb_c *) this_ptr;
unsigned retval;
@ -1145,8 +1101,7 @@ bx_keyb_c::timer_handler(void *this_ptr)
DEV_pic_raise_irq(12);
}
unsigned
bx_keyb_c::periodic( Bit32u usec_delta )
unsigned bx_keyb_c::periodic(Bit32u usec_delta)
{
/* static int multiple=0; */
static unsigned count_before_paste=0;
@ -1218,20 +1173,14 @@ bx_keyb_c::periodic( Bit32u usec_delta )
return(retval);
}
void
bx_keyb_c::activate_timer(void)
void bx_keyb_c::activate_timer(void)
{
if (BX_KEY_THIS s.kbd_controller.timer_pending == 0) {
BX_KEY_THIS s.kbd_controller.timer_pending = 1;
}
}
void
bx_keyb_c::kbd_ctrl_to_mouse(Bit8u value)
void bx_keyb_c::kbd_ctrl_to_mouse(Bit8u value)
{
// if we are not using a ps2 mouse, some of the following commands need to return different values
bx_bool is_ps2 = 0;
@ -1467,9 +1416,9 @@ bx_keyb_c::kbd_ctrl_to_mouse(Bit8u value)
}
}
void
bx_keyb_c::create_mouse_packet(bool force_enq) {
Bit8u b1, b2, b3, b4;
void bx_keyb_c::create_mouse_packet(bool force_enq)
{
Bit8u b1, b2, b3, b4;
if(BX_KEY_THIS s.mouse_internal_buffer.num_elements && !force_enq)
return;
@ -1492,40 +1441,40 @@ bx_keyb_c::create_mouse_packet(bool force_enq) {
if ( (delta_x>=0) && (delta_x<=255) ) {
b2 = (Bit8u) delta_x;
BX_KEY_THIS s.mouse.delayed_dx-=delta_x;
}
}
else if ( delta_x > 255 ) {
b2 = (Bit8u) 0xff;
BX_KEY_THIS s.mouse.delayed_dx-=255;
}
}
else if ( delta_x >= -256 ) {
b2 = (Bit8u) delta_x;
b1 |= 0x10;
BX_KEY_THIS s.mouse.delayed_dx-=delta_x;
}
}
else {
b2 = (Bit8u) 0x00;
b1 |= 0x10;
BX_KEY_THIS s.mouse.delayed_dx+=256;
}
}
if ( (delta_y>=0) && (delta_y<=255) ) {
b3 = (Bit8u) delta_y;
BX_KEY_THIS s.mouse.delayed_dy-=delta_y;
}
}
else if ( delta_y > 255 ) {
b3 = (Bit8u) 0xff;
BX_KEY_THIS s.mouse.delayed_dy-=255;
}
}
else if ( delta_y >= -256 ) {
b3 = (Bit8u) delta_y;
b1 |= 0x20;
BX_KEY_THIS s.mouse.delayed_dy-=delta_y;
}
}
else {
b3 = (Bit8u) 0x00;
b1 |= 0x20;
BX_KEY_THIS s.mouse.delayed_dy+=256;
}
}
b4 = (Bit8u) -BX_KEY_THIS s.mouse.delayed_dz;
@ -1533,8 +1482,7 @@ bx_keyb_c::create_mouse_packet(bool force_enq) {
}
void
bx_keyb_c::mouse_enabled_changed(bx_bool enabled)
void bx_keyb_c::mouse_enabled_changed(bx_bool enabled)
{
#if BX_SUPPORT_PCIUSB
// if type == usb, connect or disconnect the USB mouse
@ -1554,8 +1502,7 @@ bx_keyb_c::mouse_enabled_changed(bx_bool enabled)
BX_DEBUG(("PS/2 mouse %s", enabled?"enabled":"disabled"));
}
void
bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state)
void bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state)
{
bool force_enq=0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.h,v 1.31 2005-12-02 17:27:19 vruppert Exp $
// $Id: keyboard.h,v 1.32 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -48,15 +48,15 @@
class bx_keyb_c : public bx_keyb_stub_c {
public:
bx_keyb_c(void);
~bx_keyb_c(void);
bx_keyb_c();
virtual ~bx_keyb_c() {}
// implement bx_devmodel_c interface
virtual void init(void);
virtual void reset(unsigned type);
virtual void init(void);
virtual void reset(unsigned type);
// override stubs from bx_keyb_stub_c
virtual void gen_scancode(Bit32u key);
virtual void paste_bytes(Bit8u *data, Bit32s length);
virtual void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
virtual void gen_scancode(Bit32u key);
virtual void paste_bytes(Bit8u *data, Bit32s length);
virtual void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
// runtime options
static Bit64s kbd_param_handler(bx_param_c *param, int set, Bit64s val);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ne2k.cc,v 1.82 2006-03-02 20:13:14 vruppert Exp $
// $Id: ne2k.cc,v 1.83 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -48,8 +48,7 @@ bx_ne2k_c *theNE2kDevice = NULL;
const Bit8u ne2k_iomask[32] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
int
libne2k_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
int libne2k_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
theNE2kDevice = new bx_ne2k_c ();
bx_devices.pluginNE2kDevice = theNE2kDevice;
@ -57,12 +56,9 @@ libne2k_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *arg
return(0); // Success
}
void
libne2k_LTX_plugin_fini(void)
{
}
void libne2k_LTX_plugin_fini(void) {}
bx_ne2k_c::bx_ne2k_c(void)
bx_ne2k_c::bx_ne2k_c()
{
put("NE2K");
settype(NE2KLOG);
@ -70,7 +66,7 @@ bx_ne2k_c::bx_ne2k_c(void)
}
bx_ne2k_c::~bx_ne2k_c(void)
bx_ne2k_c::~bx_ne2k_c()
{
// nothing for now
}
@ -78,8 +74,7 @@ bx_ne2k_c::~bx_ne2k_c(void)
//
// reset - restore state to power-up, cancelling all i/o
//
void
bx_ne2k_c::reset(unsigned type)
void bx_ne2k_c::reset(unsigned type)
{
BX_DEBUG (("reset"));
// Zero out registers and memory
@ -129,8 +124,7 @@ bx_ne2k_c::reset(unsigned type)
// read_cr/write_cr - utility routines for handling reads/writes to
// the Command Register
//
Bit32u
bx_ne2k_c::read_cr(void)
Bit32u bx_ne2k_c::read_cr(void)
{
Bit32u val =
(((BX_NE2K_THIS s.CR.pgsel & 0x03) << 6) |
@ -142,8 +136,7 @@ bx_ne2k_c::read_cr(void)
return val;
}
void
bx_ne2k_c::write_cr(Bit32u value)
void bx_ne2k_c::write_cr(Bit32u value)
{
BX_DEBUG(("wrote 0x%02x to CR", value));
@ -426,8 +419,7 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit32u value, unsigned io_len)
// page0_read/page0_write - These routines handle reads/writes to
// the 'zeroth' page of the DS8390 register file
//
Bit32u
bx_ne2k_c::page0_read(Bit32u offset, unsigned int io_len)
Bit32u bx_ne2k_c::page0_read(Bit32u offset, unsigned int io_len)
{
Bit8u value = 0;
@ -538,8 +530,7 @@ bx_ne2k_c::page0_read(Bit32u offset, unsigned int io_len)
return value;
}
void
bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
void bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
{
Bit8u value2;
@ -735,13 +726,11 @@ bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
}
}
//
// page1_read/page1_write - These routines handle reads/writes to
// the first page of the DS8390 register file
//
Bit32u
bx_ne2k_c::page1_read(Bit32u offset, unsigned int io_len)
Bit32u bx_ne2k_c::page1_read(Bit32u offset, unsigned int io_len)
{
BX_DEBUG(("page 1 read from register 0x%02x, len=%u", offset, io_len));
@ -780,8 +769,7 @@ bx_ne2k_c::page1_read(Bit32u offset, unsigned int io_len)
return (0);
}
void
bx_ne2k_c::page1_write(Bit32u offset, Bit32u value, unsigned io_len)
void bx_ne2k_c::page1_write(Bit32u offset, Bit32u value, unsigned io_len)
{
BX_DEBUG(("page 1 write to register 0x%02x, len=%u, value=0x%04x", offset,
io_len, value));
@ -816,13 +804,11 @@ bx_ne2k_c::page1_write(Bit32u offset, Bit32u value, unsigned io_len)
}
}
//
// page2_read/page2_write - These routines handle reads/writes to
// the second page of the DS8390 register file
//
Bit32u
bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
Bit32u bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
{
BX_DEBUG(("page 2 read from register 0x%02x, len=%u", offset, io_len));
@ -832,31 +818,24 @@ bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
switch (offset) {
case 0x1: // PSTART
return (BX_NE2K_THIS s.page_start);
break;
case 0x2: // PSTOP
return (BX_NE2K_THIS s.page_stop);
break;
case 0x3: // Remote Next-packet pointer
return (BX_NE2K_THIS s.rempkt_ptr);
break;
case 0x4: // TPSR
return (BX_NE2K_THIS s.tx_page_start);
break;
case 0x5: // Local Next-packet pointer
return (BX_NE2K_THIS s.localpkt_ptr);
break;
case 0x6: // Address counter (upper)
return (BX_NE2K_THIS s.address_cnt >> 8);
break;
case 0x7: // Address counter (lower)
return (BX_NE2K_THIS s.address_cnt & 0xff);
break;
case 0x8: // Reserved
case 0x9:
@ -864,7 +843,6 @@ bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
case 0xb:
BX_ERROR(("reserved read - page 2, register 0x%02x", offset));
return (0xff);
break;
case 0xc: // RCR
return ((BX_NE2K_THIS s.RCR.monitor << 5) |
@ -873,14 +851,12 @@ bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
(BX_NE2K_THIS s.RCR.broadcast << 2) |
(BX_NE2K_THIS s.RCR.runts_ok << 1) |
(BX_NE2K_THIS s.RCR.errors_ok));
break;
case 0xd: // TCR
return ((BX_NE2K_THIS s.TCR.coll_prio << 4) |
(BX_NE2K_THIS s.TCR.ext_stoptx << 3) |
((BX_NE2K_THIS s.TCR.loop_cntl & 0x3) << 1) |
(BX_NE2K_THIS s.TCR.crc_disable));
break;
case 0xe: // DCR
return (((BX_NE2K_THIS s.DCR.fifo_size & 0x3) << 5) |
@ -889,7 +865,6 @@ bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
(BX_NE2K_THIS s.DCR.longaddr << 2) |
(BX_NE2K_THIS s.DCR.endian << 1) |
(BX_NE2K_THIS s.DCR.wdsize));
break;
case 0xf: // IMR
return ((BX_NE2K_THIS s.IMR.rdma_inte << 6) |
@ -899,7 +874,6 @@ bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
(BX_NE2K_THIS s.IMR.rxerr_inte << 2) |
(BX_NE2K_THIS s.IMR.tx_inte << 1) |
(BX_NE2K_THIS s.IMR.rx_inte));
break;
default:
BX_PANIC(("page 2 register 0x%02x out of range", offset));
@ -908,8 +882,7 @@ bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
return (0);
};
void
bx_ne2k_c::page2_write(Bit32u offset, Bit32u value, unsigned io_len)
void bx_ne2k_c::page2_write(Bit32u offset, Bit32u value, unsigned io_len)
{
// Maybe all writes here should be BX_PANIC()'d, since they
// affect internal operation, but let them through for now
@ -974,8 +947,7 @@ bx_ne2k_c::page2_write(Bit32u offset, Bit32u value, unsigned io_len)
//
// page3_read/page3_write - writes to this page are illegal
//
Bit32u
bx_ne2k_c::page3_read(Bit32u offset, unsigned int io_len)
Bit32u bx_ne2k_c::page3_read(Bit32u offset, unsigned int io_len)
{
if (BX_NE2K_THIS s.pci_enabled) {
switch (offset) {
@ -995,8 +967,7 @@ bx_ne2k_c::page3_read(Bit32u offset, unsigned int io_len)
}
}
void
bx_ne2k_c::page3_write(Bit32u offset, Bit32u value, unsigned io_len)
void bx_ne2k_c::page3_write(Bit32u offset, Bit32u value, unsigned io_len)
{
BX_ERROR(("page 3 write register 0x%02x attempted", offset));
}
@ -1004,16 +975,14 @@ bx_ne2k_c::page3_write(Bit32u offset, Bit32u value, unsigned io_len)
//
// tx_timer_handler/tx_timer
//
void
bx_ne2k_c::tx_timer_handler(void *this_ptr)
void bx_ne2k_c::tx_timer_handler(void *this_ptr)
{
bx_ne2k_c *class_ptr = (bx_ne2k_c *) this_ptr;
class_ptr->tx_timer();
}
void
bx_ne2k_c::tx_timer(void)
void bx_ne2k_c::tx_timer(void)
{
BX_DEBUG(("tx_timer"));
BX_NE2K_THIS s.CR.tx_packet = 0;
@ -1032,8 +1001,7 @@ bx_ne2k_c::tx_timer(void)
// mainline when the CPU attempts a read in the i/o space registered
// by this ne2000 instance
//
Bit32u
bx_ne2k_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_ne2k_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_NE2K_SMF
bx_ne2k_c *class_ptr = (bx_ne2k_c *) this_ptr;
@ -1041,8 +1009,7 @@ bx_ne2k_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
return( class_ptr->read(address, io_len) );
}
Bit32u
bx_ne2k_c::read(Bit32u address, unsigned io_len)
Bit32u bx_ne2k_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -1087,18 +1054,15 @@ bx_ne2k_c::read(Bit32u address, unsigned io_len)
// mainline when the CPU attempts a write in the i/o space registered
// by this ne2000 instance
//
void
bx_ne2k_c::write_handler(void *this_ptr, Bit32u address, Bit32u value,
void bx_ne2k_c::write_handler(void *this_ptr, Bit32u address, Bit32u value,
unsigned io_len)
{
#if !BX_USE_NE2K_SMF
bx_ne2k_c *class_ptr = (bx_ne2k_c *) this_ptr;
class_ptr->write(address, value, io_len);
}
void
bx_ne2k_c::write(Bit32u address, Bit32u value, unsigned io_len)
void bx_ne2k_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -1146,8 +1110,7 @@ bx_ne2k_c::write(Bit32u address, Bit32u value, unsigned io_len)
* mcast_index() - return the 6-bit index into the multicast
* table. Stolen unashamedly from FreeBSD's if_ed.c
*/
unsigned
bx_ne2k_c::mcast_index(const void *dst)
unsigned bx_ne2k_c::mcast_index(const void *dst)
{
#define POLYNOMIAL 0x04c11db6
Bit32u crc = 0xffffffffL;
@ -1172,8 +1135,7 @@ bx_ne2k_c::mcast_index(const void *dst)
/*
* Callback from the eth system driver when a frame has arrived
*/
void
bx_ne2k_c::rx_handler(void *arg, const void *buf, unsigned len)
void bx_ne2k_c::rx_handler(void *arg, const void *buf, unsigned len)
{
// BX_DEBUG(("rx_handler with length %d", len));
bx_ne2k_c *class_ptr = (bx_ne2k_c *) arg;
@ -1188,8 +1150,7 @@ bx_ne2k_c::rx_handler(void *arg, const void *buf, unsigned len)
* rx ring has enough room, it is copied into it and
* the receive process is updated
*/
void
bx_ne2k_c::rx_frame(const void *buf, unsigned io_len)
void bx_ne2k_c::rx_frame(const void *buf, unsigned io_len)
{
unsigned pages;
unsigned avail;
@ -1312,13 +1273,12 @@ bx_ne2k_c::rx_frame(const void *buf, unsigned io_len)
}
void
bx_ne2k_c::init(void)
void bx_ne2k_c::init(void)
{
char devname[16];
bx_list_c *base;
BX_DEBUG(("Init $Id: ne2k.cc,v 1.82 2006-03-02 20:13:14 vruppert Exp $"));
BX_DEBUG(("Init $Id: ne2k.cc,v 1.83 2006-03-07 21:11:19 sshwarts Exp $"));
// Read in values from config interface
base = (bx_list_c*) SIM->get_param(BXPN_NE2K);
@ -1446,8 +1406,7 @@ bx_ne2k_c::init(void)
}
}
void
bx_ne2k_c::set_irq_level(bx_bool level)
void bx_ne2k_c::set_irq_level(bx_bool level)
{
if (BX_NE2K_THIS s.pci_enabled) {
#if BX_SUPPORT_PCI
@ -1497,12 +1456,10 @@ bx_ne2k_c::pci_read(Bit8u address, unsigned io_len)
}
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_ne2k_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
void bx_ne2k_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_NE2K_SMF
bx_ne2k_c *class_ptr = (bx_ne2k_c *) this_ptr;
@ -1510,8 +1467,7 @@ bx_ne2k_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsign
class_ptr->pci_write(address, value, io_len);
}
void
bx_ne2k_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
void bx_ne2k_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -1583,8 +1539,7 @@ bx_ne2k_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
#define BX_LOW_BYTE(x) (0x00ff & (x))
#define BX_DUPLICATE(n) if (brief && num!=n) break;
void
bx_ne2k_c::print_info (FILE *fp, int page, int reg, int brief)
void bx_ne2k_c::print_info (FILE *fp, int page, int reg, int brief)
{
int i;
int n = 0;
@ -1814,8 +1769,7 @@ bx_ne2k_c::print_info (FILE *fp, int page, int reg, int brief)
#else
void
bx_ne2k_c::print_info (FILE *fp, int page, int reg, int brief)
void bx_ne2k_c::print_info (FILE *fp, int page, int reg, int brief)
{
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ne2k.h,v 1.17 2006-03-07 18:16:40 sshwarts Exp $
// $Id: ne2k.h,v 1.18 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -207,8 +207,8 @@ typedef struct {
class bx_ne2k_c : public bx_ne2k_stub_c {
public:
bx_ne2k_c(void);
~bx_ne2k_c(void);
bx_ne2k_c();
virtual ~bx_ne2k_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void print_info (FILE *file, int page, int reg, int nodups);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parallel.cc,v 1.27 2006-03-01 17:14:36 vruppert Exp $
// $Id: parallel.cc,v 1.28 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -39,8 +39,7 @@
bx_parallel_c *theParallelDevice = NULL;
int
libparallel_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
int libparallel_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
theParallelDevice = new bx_parallel_c ();
bx_devices.pluginParallelDevice = theParallelDevice;
@ -48,12 +47,11 @@ libparallel_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char
return(0); // Success
}
void
libparallel_LTX_plugin_fini(void)
void libparallel_LTX_plugin_fini(void)
{
}
bx_parallel_c::bx_parallel_c(void)
bx_parallel_c::bx_parallel_c()
{
put("PAR");
settype(PARLOG);
@ -62,7 +60,7 @@ bx_parallel_c::bx_parallel_c(void)
}
}
bx_parallel_c::~bx_parallel_c(void)
bx_parallel_c::~bx_parallel_c()
{
for (int i=0; i<BX_PARPORT_MAXDEV; i++) {
if (s[i].output != NULL)
@ -70,15 +68,14 @@ bx_parallel_c::~bx_parallel_c(void)
}
}
void
bx_parallel_c::init(void)
void bx_parallel_c::init(void)
{
Bit16u ports[BX_PARPORT_MAXDEV] = {0x0378, 0x0278};
Bit8u irqs[BX_PARPORT_MAXDEV] = {7, 5};
char name[16], pname[20];
bx_list_c *base;
BX_DEBUG(("Init $Id: parallel.cc,v 1.27 2006-03-01 17:14:36 vruppert Exp $"));
BX_DEBUG(("Init $Id: parallel.cc,v 1.28 2006-03-07 21:11:19 sshwarts Exp $"));
for (unsigned i=0; i<BX_N_PARALLEL_PORTS; i++) {
sprintf(pname, "ports.parallel.%d", i+1);
@ -120,45 +117,39 @@ bx_parallel_c::init(void)
}
}
void
bx_parallel_c::reset(unsigned type)
void bx_parallel_c::reset(unsigned type)
{
}
void
bx_parallel_c::virtual_printer(Bit8u port)
void bx_parallel_c::virtual_printer(Bit8u port)
{
if (BX_PAR_THIS s[port].STATUS.slct) {
if (BX_PAR_THIS s[port].output != NULL) {
fputc(BX_PAR_THIS s[port].data, BX_PAR_THIS s[port].output);
fflush (BX_PAR_THIS s[port].output);
}
}
if (BX_PAR_THIS s[port].CONTROL.irq == 1) {
DEV_pic_raise_irq(BX_PAR_THIS s[port].IRQ);
}
}
BX_PAR_THIS s[port].STATUS.ack = 0;
BX_PAR_THIS s[port].STATUS.busy = 1;
}
}
else {
BX_ERROR(("data is valid, but printer is offline"));
}
}
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_parallel_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_parallel_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_PAR_SMF
bx_parallel_c *class_ptr = (bx_parallel_c *) this_ptr;
return( class_ptr->read(address, io_len) );
return class_ptr->read(address, io_len);
}
Bit32u
bx_parallel_c::read(Bit32u address, unsigned io_len)
Bit32u bx_parallel_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -224,12 +215,10 @@ bx_parallel_c::read(Bit32u address, unsigned io_len)
return(0);
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_parallel_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_parallel_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PAR_SMF
bx_parallel_c *class_ptr = (bx_parallel_c *) this_ptr;
@ -237,8 +226,7 @@ bx_parallel_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsig
class_ptr->write(address, value, io_len);
}
void
bx_parallel_c::write(Bit32u address, Bit32u value, unsigned io_len)
void bx_parallel_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parallel.h,v 1.13 2006-03-07 18:16:40 sshwarts Exp $
// $Id: parallel.h,v 1.14 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -27,7 +27,6 @@
#ifndef BX_IODEV_PARPORT_H
#define BX_IODEV_PARPORT_H
#if BX_USE_PAR_SMF
# define BX_PAR_SMF static
# define BX_PAR_THIS theParallelDevice->
@ -64,14 +63,12 @@ typedef struct {
bx_bool initmode;
} bx_par_t;
class bx_parallel_c : public bx_devmodel_c {
public:
bx_parallel_c(void);
~bx_parallel_c(void);
virtual void init(void);
virtual void reset(unsigned type);
bx_parallel_c();
virtual ~bx_parallel_c();
virtual void init(void);
virtual void reset(unsigned type);
private:
bx_par_t s[BX_PARPORT_MAXDEV];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci.cc,v 1.45 2006-03-07 18:16:40 sshwarts Exp $
// $Id: pci.cc,v 1.46 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -68,12 +68,11 @@ void bx_pci_bridge_c::init(void)
{
// called once when bochs initializes
unsigned i;
BX_PCI_THIS num_pci_handles = 0;
BX_PCI_THIS num_pci_handlers = 0;
/* set unused elements to appropriate values */
for (i=0; i < BX_MAX_PCI_DEVICES; i++) {
BX_PCI_THIS pci_handler[i].read = NULL;
BX_PCI_THIS pci_handler[i].write = NULL;
BX_PCI_THIS pci_handler[i].handler = NULL;
}
for (i=0; i < 0x100; i++) {
@ -97,8 +96,7 @@ void bx_pci_bridge_c::init(void)
}
Bit8u devfunc = BX_PCI_DEVICE(0,0);
DEV_register_pci_handlers(this, pci_read_handler, pci_write_handler,
&devfunc, BX_PLUGIN_PCI, "440FX Host bridge");
DEV_register_pci_handlers(this, &devfunc, BX_PLUGIN_PCI, "440FX Host bridge");
for (i=0; i<256; i++)
BX_PCI_THIS s.i440fx.pci_conf[i] = 0x0;
@ -186,8 +184,7 @@ Bit32u bx_pci_bridge_c::read(Bit32u address, unsigned io_len)
regnum = (BX_PCI_THIS s.i440fx.confAddr & 0xfc) + (address & 0x03);
handle = BX_PCI_THIS pci_handler_id[devfunc];
if ((io_len <= 4) && (handle < BX_MAX_PCI_DEVICES))
retval = (* BX_PCI_THIS pci_handler[handle].read)
(BX_PCI_THIS pci_handler[handle].this_ptr, regnum, io_len);
retval = BX_PCI_THIS pci_handler[handle].handler->pci_read_handler(regnum, io_len);
else
retval = 0xFFFFFFFF;
}
@ -246,8 +243,7 @@ void bx_pci_bridge_c::write(Bit32u address, Bit32u value, unsigned io_len)
handle = BX_PCI_THIS pci_handler_id[devfunc];
if ((io_len <= 4) && (handle < BX_MAX_PCI_DEVICES)) {
if (((regnum>=4) && (regnum<=7)) || (regnum==12) || (regnum==13) || (regnum>14)) {
(* BX_PCI_THIS pci_handler[handle].write)
(BX_PCI_THIS pci_handler[handle].this_ptr, regnum, value, io_len);
BX_PCI_THIS pci_handler[handle].handler->pci_write_handler(regnum, value, io_len);
BX_PCI_THIS s.i440fx.confData = value << (8 * (address & 0x03));
}
else
@ -262,22 +258,9 @@ void bx_pci_bridge_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
}
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u bx_pci_bridge_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pci_bridge_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_PCI_SMF
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u bx_pci_bridge_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCI_SMF
Bit32u val440fx = 0;
if (io_len <= 4) {
@ -291,22 +274,9 @@ Bit32u bx_pci_bridge_c::pci_read(Bit8u address, unsigned io_len)
return(0xffffffff);
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void bx_pci_bridge_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// pci configuration space write callback handler
void bx_pci_bridge_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PCI_SMF
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void bx_pci_bridge_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCI_SMF
Bit8u value8;
if ((address >= 0x10) && (address < 0x34))
@ -329,7 +299,6 @@ void bx_pci_bridge_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
}
}
Bit8u bx_pci_bridge_c::rd_memType(Bit32u addr)
{
switch ((addr & 0xFC000) >> 12) {
@ -436,10 +405,9 @@ void bx_pci_bridge_c::print_i440fx_state()
#endif /* DUMP_FULL_I440FX */
}
bx_bool
bx_pci_bridge_c::register_pci_handlers( void *this_ptr, bx_pci_read_handler_t f1,
bx_pci_write_handler_t f2, Bit8u *devfunc,
const char *name, const char *descr)
bx_bool bx_pci_bridge_c::register_pci_handlers(bx_pci_device_stub_c *dev,
Bit8u *devfunc, const char *name,
const char *descr)
{
unsigned i, handle;
char devname[80];
@ -463,15 +431,13 @@ bx_pci_bridge_c::register_pci_handlers( void *this_ptr, bx_pci_read_handler_t f1
}
/* check if device/function is available */
if (BX_PCI_THIS pci_handler_id[*devfunc] == BX_MAX_PCI_DEVICES) {
if (BX_PCI_THIS num_pci_handles >= BX_MAX_PCI_DEVICES) {
if (BX_PCI_THIS num_pci_handlers >= BX_MAX_PCI_DEVICES) {
BX_INFO(("too many PCI devices installed."));
BX_PANIC((" try increasing BX_MAX_PCI_DEVICES"));
return false;
}
handle = BX_PCI_THIS num_pci_handles++;
BX_PCI_THIS pci_handler[handle].read = f1;
BX_PCI_THIS pci_handler[handle].write = f2;
BX_PCI_THIS pci_handler[handle].this_ptr = this_ptr;
handle = BX_PCI_THIS num_pci_handlers++;
BX_PCI_THIS pci_handler[handle].handler = dev;
BX_PCI_THIS pci_handler_id[*devfunc] = handle;
BX_INFO(("%s present at device %d, function %d", descr, *devfunc >> 3,
*devfunc & 0x07));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci.h,v 1.23 2006-03-07 18:16:40 sshwarts Exp $
// $Id: pci.h,v 1.24 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -31,9 +31,6 @@
#define BX_PCI_DEVICE(device, function) ((device)<<3 | (function))
typedef Bit32u (*bx_pci_read_handler_t)(void *, Bit8u, unsigned);
typedef void (*bx_pci_write_handler_t)(void *, Bit8u, Bit32u, unsigned);
#if BX_USE_PCI_SMF
# define BX_PCI_SMF static
# define BX_PCI_THIS thePciBridge->
@ -42,7 +39,6 @@ typedef void (*bx_pci_write_handler_t)(void *, Bit8u, Bit32u, unsigned);
# define BX_PCI_THIS this->
#endif
#define BX_PCI_INTA 1
#define BX_PCI_INTB 2
#define BX_PCI_INTC 3
@ -54,15 +50,15 @@ typedef struct {
Bit8u pci_conf[256];
} bx_def440fx_t;
class bx_pci_device_stub_c;
class bx_pci_bridge_c : public bx_pci_bridge_stub_c {
public:
bx_pci_bridge_c();
~bx_pci_bridge_c();
virtual ~bx_pci_bridge_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual bx_bool register_pci_handlers(void *this_ptr,
bx_pci_read_handler_t f1,
bx_pci_write_handler_t f2,
virtual bx_bool register_pci_handlers(bx_pci_device_stub_c *device,
Bit8u *devfunc, const char *name,
const char *descr);
virtual bx_bool is_pci_device(const char *name);
@ -77,14 +73,15 @@ public:
virtual Bit8u rd_memType (Bit32u addr);
virtual Bit8u wr_memType (Bit32u addr);
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
private:
Bit8u pci_handler_id[0x100]; // 256 devices/functions
struct {
bx_pci_read_handler_t read;
bx_pci_write_handler_t write;
void *this_ptr;
bx_pci_device_stub_c *handler;
} pci_handler[BX_MAX_PCI_DEVICES];
unsigned num_pci_handles;
unsigned num_pci_handlers;
bx_bool slot_used[BX_N_PCI_SLOTS];
bx_bool slots_checked;
@ -95,13 +92,9 @@ private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
#if !BX_USE_PCI_SMF
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci2isa.cc,v 1.26 2006-03-07 18:16:40 sshwarts Exp $
// $Id: pci2isa.cc,v 1.27 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -67,8 +67,8 @@ void bx_pci2isa_c::init(void)
// called once when bochs initializes
Bit8u devfunc = BX_PCI_DEVICE(1,0);
DEV_register_pci_handlers(this, pci_read_handler, pci_write_handler,
&devfunc, BX_PLUGIN_PCI2ISA, "PIIX3 PCI-to-ISA bridge");
DEV_register_pci_handlers(this, &devfunc, BX_PLUGIN_PCI2ISA,
"PIIX3 PCI-to-ISA bridge");
DEV_register_iowrite_handler(this, write_handler, 0x00B2, "PIIX3 PCI-to-ISA bridge", 1);
DEV_register_iowrite_handler(this, write_handler, 0x00B3, "PIIX3 PCI-to-ISA bridge", 1);
@ -279,26 +279,12 @@ void bx_pci2isa_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
}
break;
}
}
}
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u bx_pci2isa_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pci2isa_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_P2I_SMF
bx_pci2isa_c *class_ptr = (bx_pci2isa_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u bx_pci2isa_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_P2I_SMF
Bit32u value = 0;
if (io_len <= 4) {
@ -312,23 +298,9 @@ Bit32u bx_pci2isa_c::pci_read(Bit8u address, unsigned io_len)
return(0xffffffff);
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void bx_pci2isa_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// pci configuration space write callback handler
void bx_pci2isa_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_P2I_SMF
bx_pci2isa_c *class_ptr = (bx_pci2isa_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void bx_pci2isa_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_P2I_SMF
Bit8u value8;
if ((address >= 0x10) && (address < 0x34))

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci2isa.h,v 1.10 2006-03-07 18:16:40 sshwarts Exp $
// $Id: pci2isa.h,v 1.11 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -40,11 +40,14 @@
class bx_pci2isa_c : public bx_pci2isa_stub_c {
public:
bx_pci2isa_c();
~bx_pci2isa_c();
virtual ~bx_pci2isa_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level);
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
private:
struct {
@ -61,13 +64,9 @@ private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
#if !BX_USE_P2I_SMF
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci_ide.cc,v 1.21 2006-03-06 19:23:13 sshwarts Exp $
// $Id: pci_ide.cc,v 1.22 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -81,8 +81,8 @@ void bx_pci_ide_c::init(void)
unsigned i;
Bit8u devfunc = BX_PCI_DEVICE(1,1);
DEV_register_pci_handlers(this, pci_read_handler, pci_write_handler,
&devfunc, BX_PLUGIN_PCI_IDE, "PIIX3 PCI IDE controller");
DEV_register_pci_handlers(this, &devfunc,
BX_PLUGIN_PCI_IDE, "PIIX3 PCI IDE controller");
// register BM-DMA timer
for (i=0; i<2; i++) {
@ -327,22 +327,9 @@ void bx_pci_ide_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u bx_pci_ide_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pci_ide_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_PIDE_SMF
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u bx_pci_ide_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PIDE_SMF
Bit32u value = 0;
if (io_len <= 4) {
@ -356,22 +343,9 @@ Bit32u bx_pci_ide_c::pci_read(Bit8u address, unsigned io_len)
}
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void bx_pci_ide_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// pci configuration space write callback handler
void bx_pci_ide_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PIDE_SMF
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void bx_pci_ide_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PIDE_SMF
Bit8u value8, oldval;
bx_bool bmdma_change = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pci_ide.h,v 1.9 2006-03-07 18:16:40 sshwarts Exp $
// $Id: pci_ide.h,v 1.10 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -40,12 +40,15 @@
class bx_pci_ide_c : public bx_pci_ide_stub_c {
public:
bx_pci_ide_c();
~bx_pci_ide_c();
virtual ~bx_pci_ide_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual bx_bool bmdma_present(void);
virtual void bmdma_set_irq(Bit8u channel);
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
static void timer_handler(void *);
BX_PIDE_SMF void timer(void);
@ -69,13 +72,9 @@ private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
#if !BX_USE_PIDE_SMF
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif
};

View File

@ -47,10 +47,7 @@ int libpcidev_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, cha
return 0; // Success
}
void libpcidev_LTX_plugin_fini(void)
{
}
void libpcidev_LTX_plugin_fini(void) {}
bx_pcidev_c::bx_pcidev_c()
{
@ -194,10 +191,7 @@ void bx_pcidev_c::init(void)
(unsigned)find.bus, (unsigned)find.device, (unsigned)find.func));
Bit8u devfunc = 0x00;
DEV_register_pci_handlers(this,
pci_read_handler,
pci_write_handler,
&devfunc, BX_PLUGIN_PCIDEV,
DEV_register_pci_handlers(this, &devfunc, BX_PLUGIN_PCIDEV,
pcidev_name);
BX_PCIDEV_THIS irq = PCIDEV_IRQ; // initial irq value
@ -277,22 +271,9 @@ void bx_pcidev_c::init(void)
void bx_pcidev_c::reset(unsigned type) { }
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u bx_pcidev_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pcidev_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_PCIDEV_SMF
bx_pcidev_c *class_ptr = (bx_pcidev_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u bx_pcidev_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIDEV_SMF
int ret = -1;
if (io_len > 4 || io_len == 0) {
@ -337,24 +318,9 @@ Bit32u bx_pcidev_c::pci_read(Bit8u address, unsigned io_len)
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_pcidev_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// pci configuration space write callback handler
void bx_pcidev_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PCIDEV_SMF
bx_pcidev_c *class_ptr = (bx_pcidev_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void
bx_pcidev_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIDEV_SMF
int ret = -1;
if (io_len > 4 || io_len == 0) {

View File

@ -37,13 +37,15 @@
class bx_pcidev_c *pcidev;
};
class bx_pcidev_c : public bx_devmodel_c
{
class bx_pcidev_c : public bx_pci_device_stub_c {
public:
bx_pcidev_c();
~bx_pcidev_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual ~bx_pcidev_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
int pcidev_fd; // to access the pcidev
@ -52,17 +54,9 @@ public:
int irq;
private:
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
static Bit32u read_handler(void *param, Bit32u address, unsigned io_len);
static void write_handler(void *param, Bit32u address, Bit32u value, unsigned io_len);
#if !BX_USE_PCIDEV_SMF
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
Bit32u read(void *param, Bit32u address, unsigned io_len);
void write(void *param, Bit32u address, Bit32u value, unsigned io_len);
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pcipnic.cc,v 1.17 2006-03-02 20:13:14 vruppert Exp $
// $Id: pcipnic.cc,v 1.18 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003 Fen Systems Ltd.
@ -44,27 +44,20 @@ libpcipnic_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *
return 0; // Success
}
void
libpcipnic_LTX_plugin_fini(void)
{
}
void libpcipnic_LTX_plugin_fini(void) {}
bx_pcipnic_c::bx_pcipnic_c(void)
bx_pcipnic_c::bx_pcipnic_c()
{
put("PNIC");
settype(PCIPNICLOG);
}
bx_pcipnic_c::~bx_pcipnic_c(void)
bx_pcipnic_c::~bx_pcipnic_c()
{
// nothing for now
BX_DEBUG(("Exit."));
}
void
bx_pcipnic_c::init(void)
void bx_pcipnic_c::init(void)
{
// called once when bochs initializes
@ -73,10 +66,7 @@ bx_pcipnic_c::init(void)
memcpy(BX_PNIC_THIS s.physaddr, SIM->get_param_string("macaddr", base)->getptr(), 6);
BX_PNIC_THIS s.devfunc = 0x00;
DEV_register_pci_handlers(this,
pci_read_handler,
pci_write_handler,
&BX_PNIC_THIS s.devfunc, BX_PLUGIN_PCIPNIC,
DEV_register_pci_handlers(this, &BX_PNIC_THIS s.devfunc, BX_PLUGIN_PCIPNIC,
"Experimental PCI Pseudo NIC");
for (unsigned i=0; i<256; i++) {
@ -111,8 +101,7 @@ bx_pcipnic_c::init(void)
BX_INFO(("PCI Pseudo NIC initialized - I/O base and IRQ assigned by PCI BIOS"));
}
void
bx_pcipnic_c::reset(unsigned type)
void bx_pcipnic_c::reset(unsigned type)
{
unsigned i;
@ -158,28 +147,22 @@ bx_pcipnic_c::reset(unsigned type)
set_irq_level(0);
}
void
bx_pcipnic_c::set_irq_level(bx_bool level)
void bx_pcipnic_c::set_irq_level(bx_bool level)
{
DEV_pci_set_irq(BX_PNIC_THIS s.devfunc, BX_PNIC_THIS s.pci_conf[0x3d], level);
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_pcipnic_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_pcipnic_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_PCIPNIC_SMF
bx_pcipnic_c *class_ptr = (bx_pcipnic_c *) this_ptr;
return( class_ptr->read(address, io_len) );
return class_ptr->read(address, io_len);
}
Bit32u
bx_pcipnic_c::read(Bit32u address, unsigned io_len)
Bit32u bx_pcipnic_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -218,12 +201,10 @@ bx_pcipnic_c::read(Bit32u address, unsigned io_len)
return(val);
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_pcipnic_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_pcipnic_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PCIPNIC_SMF
bx_pcipnic_c *class_ptr = (bx_pcipnic_c *) this_ptr;
@ -231,8 +212,7 @@ bx_pcipnic_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsign
class_ptr->write(address, value, io_len);
}
void
bx_pcipnic_c::write(Bit32u address, Bit32u value, unsigned io_len)
void bx_pcipnic_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -283,26 +263,9 @@ void bx_pcipnic_c::pnic_timer(void)
}
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_pcipnic_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pcipnic_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_PCIPNIC_SMF
bx_pcipnic_c *class_ptr = (bx_pcipnic_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u
bx_pcipnic_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIPNIC_SMF
Bit32u value = 0;
if (io_len > 4 || io_len == 0) {
@ -358,25 +321,9 @@ bx_pcipnic_c::pci_read(Bit8u address, unsigned io_len)
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_pcipnic_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// pci configuration space write callback handler
void bx_pcipnic_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PCIPNIC_SMF
bx_pcipnic_c *class_ptr = (bx_pcipnic_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void
bx_pcipnic_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIPNIC_SMF
Bit8u value8, oldval;
bx_bool baseaddr_change = 0;
@ -435,8 +382,7 @@ bx_pcipnic_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
/*
* Execute a hardware command.
*/
void
bx_pcipnic_c::exec_command(void)
void bx_pcipnic_c::exec_command(void)
{
Bit16u command = BX_PNIC_THIS s.rCmd;
Bit16u ilength = BX_PNIC_THIS s.rLength;
@ -450,7 +396,6 @@ bx_pcipnic_c::exec_command(void)
ilength, BX_PNIC_THIS s.rDataCursor ));
switch ( command ) {
case PNIC_CMD_NOOP :
status = PNIC_STATUS_OK;
break;
@ -539,12 +484,10 @@ bx_pcipnic_c::exec_command(void)
/*
* Callback from the eth system driver when a frame has arrived
*/
void
bx_pcipnic_c::rx_handler(void *arg, const void *buf, unsigned len)
void bx_pcipnic_c::rx_handler(void *arg, const void *buf, unsigned len)
{
// BX_DEBUG(("rx_handler with length %d", len));
bx_pcipnic_c *class_ptr = (bx_pcipnic_c *) arg;
class_ptr->rx_frame(buf, len);
}
@ -555,8 +498,7 @@ bx_pcipnic_c::rx_handler(void *arg, const void *buf, unsigned len)
* rx ring has enough room, it is copied into it and
* the receive process is updated
*/
void
bx_pcipnic_c::rx_frame(const void *buf, unsigned io_len)
void bx_pcipnic_c::rx_frame(const void *buf, unsigned io_len)
{
// Check packet length
if ( io_len > PNIC_DATA_SIZE ) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pcipnic.h,v 1.4 2006-03-07 18:16:40 sshwarts Exp $
// $Id: pcipnic.h,v 1.5 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003 Fen Systems Ltd.
@ -60,13 +60,16 @@ typedef struct {
} bx_pnic_t;
class bx_pcipnic_c : public bx_devmodel_c {
class bx_pcipnic_c : public bx_pci_device_stub_c {
public:
bx_pcipnic_c();
~bx_pcipnic_c();
virtual ~bx_pcipnic_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
private:
bx_pnic_t s;
@ -77,13 +80,9 @@ private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
#if !BX_USE_PCIPNIC_SMF
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif
eth_pktmover_c *ethdev;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pciusb.cc,v 1.35 2006-03-07 18:16:41 sshwarts Exp $
// $Id: pciusb.cc,v 1.36 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -103,10 +103,7 @@ void bx_pciusb_c::init(void)
bx_pc_system.register_timer(this, usb_timer_handler, 1000, 1,1, "usb.timer");
BX_USB_THIS hub[0].devfunc = BX_PCI_DEVICE(1,2);
DEV_register_pci_handlers(this,
pci_read_handler,
pci_write_handler,
&BX_USB_THIS hub[0].devfunc, BX_PLUGIN_PCIUSB,
DEV_register_pci_handlers(this, &BX_USB_THIS hub[0].devfunc, BX_PLUGIN_PCIUSB,
"Experimental PCI USB");
for (unsigned i=0; i<256; i++) {
@ -1418,22 +1415,9 @@ void bx_pciusb_c::set_status(struct TD *td, bx_bool stalled, bx_bool data_buffer
td->dword1 &= ~((1<<28) | (1<<27)); // clear the c_err field in there was an error
}
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u bx_pciusb_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pciusb_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_PCIUSB_SMF
bx_pciusb_c *class_ptr = (bx_pciusb_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u bx_pciusb_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIUSB_SMF
Bit32u value = 0;
if (io_len > 4 || io_len == 0) {
@ -1488,22 +1472,9 @@ Bit32u bx_pciusb_c::pci_read(Bit8u address, unsigned io_len)
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void bx_pciusb_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// pci configuration space write callback handler
void bx_pciusb_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PCIUSB_SMF
bx_pciusb_c *class_ptr = (bx_pciusb_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void bx_pciusb_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIUSB_SMF
Bit8u value8, oldval;
bx_bool baseaddr_change = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pciusb.h,v 1.15 2006-03-07 18:16:41 sshwarts Exp $
// $Id: pciusb.h,v 1.16 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -335,10 +335,10 @@ struct HCSTACK {
bx_bool t;
};
class bx_pciusb_c : public bx_usb_stub_c {
class bx_pciusb_c : public bx_pci_usb_stub_c {
public:
bx_pciusb_c();
~bx_pciusb_c();
virtual ~bx_pciusb_c();
virtual void init(void);
virtual void reset(unsigned);
virtual void usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
@ -346,10 +346,12 @@ public:
virtual bx_bool usb_key_enq(Bit8u *scan_code);
virtual bx_bool usb_keyboard_connected();
virtual bx_bool usb_mouse_connected();
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
static char *usb_param_handler(bx_param_string_c *param, int set, char *val, int maxlen);
private:
bx_bool busy;
bx_usb_t hub[BX_USB_CONFDEV];
@ -392,13 +394,9 @@ private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
#if !BX_USE_PCIUSB_SMF
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pcivga.cc,v 1.8 2005-09-18 13:02:56 vruppert Exp $
// $Id: pcivga.cc,v 1.9 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002,2003 Mike Nordell
@ -40,8 +40,7 @@
bx_pcivga_c* thePciVgaAdapter = 0;
int
libpcivga_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
int libpcivga_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
thePciVgaAdapter = new bx_pcivga_c ();
bx_devices.pluginPciVgaAdapter = thePciVgaAdapter;
@ -49,37 +48,27 @@ libpcivga_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *a
return 0; // Success
}
void
libpcivga_LTX_plugin_fini(void)
{
}
void libpcivga_LTX_plugin_fini(void) {}
bx_pcivga_c::bx_pcivga_c(void)
bx_pcivga_c::bx_pcivga_c()
{
put("PCIVGA");
settype(PCIVGALOG);
}
bx_pcivga_c::~bx_pcivga_c(void)
bx_pcivga_c::~bx_pcivga_c()
{
// nothing for now
BX_DEBUG(("Exit."));
}
void
bx_pcivga_c::init(void)
void bx_pcivga_c::init(void)
{
// called once when bochs initializes
Bit8u devfunc = 0x00;
unsigned i;
DEV_register_pci_handlers(this,
pci_read_handler,
pci_write_handler,
&devfunc, BX_PLUGIN_PCIVGA,
DEV_register_pci_handlers(this, &devfunc, BX_PLUGIN_PCIVGA,
"Experimental PCI VGA");
for (i=0; i<256; i++) {
@ -105,8 +94,7 @@ bx_pcivga_c::init(void)
}
}
void
bx_pcivga_c::reset(unsigned type)
void bx_pcivga_c::reset(unsigned type)
{
static const struct reset_vals_t {
unsigned addr;
@ -120,27 +108,9 @@ bx_pcivga_c::reset(unsigned type)
}
}
// static pci configuration space read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_pcivga_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
// pci configuration space read callback handler
Bit32u bx_pcivga_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_PCIVGA_SMF
bx_pcivga_c *class_ptr = (bx_pcivga_c *) this_ptr;
return class_ptr->pci_read(address, io_len);
}
Bit32u
bx_pcivga_c::pci_read(Bit8u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIVGA_SMF
Bit32u value = 0;
if (io_len > 4 || io_len == 0) {
@ -196,25 +166,9 @@ bx_pcivga_c::pci_read(Bit8u address, unsigned io_len)
}
// static pci configuration space write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_pcivga_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
// static pci configuration space write callback handler
void bx_pcivga_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_PCIVGA_SMF
bx_pcivga_c *class_ptr = (bx_pcivga_c *) this_ptr;
class_ptr->pci_write(address, value, io_len);
}
void
bx_pcivga_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_PCIVGA_SMF
if ((address >= 0x10) && (address < 0x34))
return;
// This odd code is to display only what bytes actually were written.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pcivga.h,v 1.4 2006-03-07 18:16:41 sshwarts Exp $
// $Id: pcivga.h,v 1.5 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002,2003 Mike Nordell
@ -27,25 +27,20 @@
# define BX_PCIVGA_THIS this->
#endif
class bx_pcivga_c : public bx_devmodel_c {
class bx_pcivga_c : public bx_devmodel_c, public bx_pci_device_stub_c {
public:
bx_pcivga_c();
~bx_pcivga_c();
virtual ~bx_pcivga_c();
virtual void init(void);
virtual void reset(unsigned type);
private:
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
private:
struct {
Bit8u pci_conf[256];
} s;
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
#if !BX_USE_PCIVGA_SMF
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif
};
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pic.h,v 1.15 2006-03-07 18:16:41 sshwarts Exp $
// $Id: pic.h,v 1.16 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -70,7 +70,7 @@ typedef struct {
class bx_pic_c : public bx_pic_stub_c {
public:
bx_pic_c();
~bx_pic_c();
virtual ~bx_pic_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void lower_irq(unsigned irq_no);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pit.h,v 1.13 2004-12-13 19:10:38 vruppert Exp $
// $Id: pit.h,v 1.14 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -58,15 +58,12 @@ typedef struct {
bx_bool active;
bx_bool GATE; // GATE input pin
bx_bool OUT; // OUT output pin
} bx_pit_t;
} bx_pit_t;
class bx_pit_c : public logfunctions {
public:
bx_pit_c( void );
~bx_pit_c( void );
bx_pit_c();
virtual ~bx_pit_c();
BX_PIT_SMF int init(void);
BX_PIT_SMF void reset( unsigned type);
BX_PIT_SMF bx_bool periodic( Bit32u usec_delta );
@ -85,14 +82,14 @@ private:
Bit8u speaker_data_on;
bx_bool refresh_clock_div2;
int timer_handle[3];
} s;
} s;
BX_PIT_SMF void write_count_reg( Bit8u value, unsigned timerid );
BX_PIT_SMF Bit8u read_counter( unsigned timerid );
BX_PIT_SMF void latch( unsigned timerid );
BX_PIT_SMF void set_GATE(unsigned pit_id, unsigned value);
BX_PIT_SMF void start(unsigned timerid);
};
};
extern bx_pit_c bx_pit;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////
// $Id: pit_wrap.cc,v 1.60 2006-01-08 20:39:08 vruppert Exp $
// $Id: pit_wrap.cc,v 1.61 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -80,8 +80,7 @@ bx_pit_c bx_pit;
#define TICKS_TO_USEC(a) ( ((a)*USEC_PER_SECOND)/TICKS_PER_SECOND )
#define USEC_TO_TICKS(a) ( ((a)*TICKS_PER_SECOND)/USEC_PER_SECOND )
bx_pit_c::bx_pit_c( void )
bx_pit_c::bx_pit_c()
{
put("PIT");
settype(PITLOG);
@ -94,12 +93,7 @@ bx_pit_c::bx_pit_c( void )
BX_PIT_THIS s.timer_handle[0] = BX_NULL_TIMER_HANDLE;
}
bx_pit_c::~bx_pit_c( void )
{
}
int
bx_pit_c::init( void )
int bx_pit_c::init(void)
{
DEV_register_irq(0, "8254 PIT");
DEV_register_ioread_handler(this, read_handler, 0x0040, "8254 PIT", 1);
@ -152,21 +146,19 @@ bx_pit_c::init( void )
return(1);
}
void
bx_pit_c::reset(unsigned type)
void bx_pit_c::reset(unsigned type)
{
BX_PIT_THIS s.timer.reset(type);
}
void
bx_pit_c::timer_handler(void *this_ptr) {
void bx_pit_c::timer_handler(void *this_ptr)
{
bx_pit_c * class_ptr = (bx_pit_c *) this_ptr;
class_ptr->handle_timer();
}
void
bx_pit_c::handle_timer() {
void bx_pit_c::handle_timer()
{
Bit64u my_time_usec = bx_virt_timer.time_usec();
Bit64u time_passed = my_time_usec-BX_PIT_THIS s.last_usec;
Bit32u time_passed32 = (Bit32u)time_passed;
@ -198,22 +190,17 @@ bx_pit_c::handle_timer() {
BX_DEBUG(("s.last_next_event_time=%d",BX_PIT_THIS s.last_next_event_time));
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_pit_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_pit_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_PIT_SMF
bx_pit_c *class_ptr = (bx_pit_c *) this_ptr;
return( class_ptr->read(address, io_len) );
return class_ptr->read(address, io_len);
}
Bit32u
bx_pit_c::read( Bit32u address, unsigned int io_len )
Bit32u bx_pit_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -257,22 +244,17 @@ bx_pit_c::read( Bit32u address, unsigned int io_len )
return(0); /* keep compiler happy */
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_pit_c::write_handler(void *this_ptr, Bit32u address, Bit32u dvalue, unsigned io_len)
void bx_pit_c::write_handler(void *this_ptr, Bit32u address, Bit32u dvalue, unsigned io_len)
{
#if !BX_USE_PIT_SMF
bx_pit_c *class_ptr = (bx_pit_c *) this_ptr;
class_ptr->write(address, dvalue, io_len);
}
void
bx_pit_c::write( Bit32u address, Bit32u dvalue,
unsigned int io_len )
void bx_pit_c::write(Bit32u address, Bit32u dvalue, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -350,7 +332,6 @@ bx_pit_c::write( Bit32u address, Bit32u dvalue,
}
bx_bool bx_pit_c::periodic(Bit32u usec_delta)
{
Bit32u ticks_delta = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pit_wrap.h,v 1.21 2006-01-08 20:39:08 vruppert Exp $
// $Id: pit_wrap.h,v 1.22 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -47,11 +47,11 @@
class bx_pit_c : public logfunctions {
public:
bx_pit_c( void );
~bx_pit_c( void );
BX_PIT_SMF int init( void );
BX_PIT_SMF void reset( unsigned type);
BX_PIT_SMF bx_bool periodic( Bit32u usec_delta );
bx_pit_c();
virtual ~bx_pit_c() {}
BX_PIT_SMF int init(void);
BX_PIT_SMF void reset(unsigned type);
BX_PIT_SMF bx_bool periodic(Bit32u usec_delta);
Bit16u get_timer(int Timer) {
return s.timer.get_inlatch(Timer);
@ -61,8 +61,8 @@ private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
#if !BX_USE_PIT_SMF
Bit32u read( Bit32u addr, unsigned int len );
void write( Bit32u addr, Bit32u Value, unsigned int len );
Bit32u read(Bit32u addr, unsigned len);
void write(Bit32u addr, Bit32u Value, unsigned len);
#endif
struct s_type {
@ -84,7 +84,7 @@ private:
Bit64u em_last_realtime;
Bit64u last_realtime_delta;
Bit64u last_realtime_ticks;
} s;
} s;
static void timer_handler(void *this_ptr);
BX_PIT_SMF void handle_timer();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sb16.h,v 1.23 2006-03-07 18:16:41 sshwarts Exp $
// $Id: sb16.h,v 1.24 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -194,9 +194,8 @@ class BX_SOUND_OUTPUT_C_DEF;
// The actual emulator class, emulating the sound blaster ports
class bx_sb16_c : public bx_devmodel_c {
public:
bx_sb16_c(void);
~bx_sb16_c(void);
bx_sb16_c();
virtual ~bx_sb16_c();
virtual void init(void);
virtual void reset(unsigned type);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: serial.h,v 1.27 2006-03-07 18:16:41 sshwarts Exp $
// $Id: serial.h,v 1.28 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -203,7 +203,7 @@ typedef struct {
class bx_serial_c : public bx_serial_stub_c {
public:
bx_serial_c();
~bx_serial_c();
virtual ~bx_serial_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void serial_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: serial_raw.cc,v 1.19 2006-01-08 15:23:25 vruppert Exp $
// $Id: serial_raw.cc,v 1.20 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -43,7 +43,7 @@
DWORD WINAPI RawSerialThread(VOID *this_ptr);
#endif
serial_raw::serial_raw (char *devname)
serial_raw::serial_raw(char *devname)
{
#ifdef WIN32
char portstr[MAX_PATH];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: serial_raw.h,v 1.11 2004-05-13 16:23:15 vruppert Exp $
// $Id: serial_raw.h,v 1.12 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
@ -37,9 +37,9 @@
#define RX_BUFSIZE 256
class serial_raw : public logfunctions {
public:
public:
serial_raw (char *devname);
~serial_raw (void);
virtual ~serial_raw ();
void set_baudrate (int rate);
void set_data_bits (int );
void set_stop_bits (int);

View File

@ -14,7 +14,7 @@ This code may be distributed under the same terms as bochs.
class bx_speaker_c : public bx_speaker_stub_c {
public:
bx_speaker_c();
~bx_speaker_c();
virtual ~bx_speaker_c();
virtual void init(void);
virtual void reset(unsigned int);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: svga_cirrus.cc,v 1.29 2006-03-07 18:16:41 sshwarts Exp $
// $Id: svga_cirrus.cc,v 1.30 2006-03-07 21:11:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Makoto Suzuki (suzu)
@ -2241,7 +2241,6 @@ void bx_svga_cirrus_c::svga_init_pcihandlers(void)
Bit8u devfunc = 0x00;
DEV_register_pci_handlers(BX_CIRRUS_THIS_PTR,
pci_read_handler, pci_write_handler,
&devfunc, "cirrus", "SVGA Cirrus PCI");
for (i=0; i<256; i++) {
@ -2269,15 +2268,8 @@ void bx_svga_cirrus_c::svga_init_pcihandlers(void)
BX_CIRRUS_THIS pci_mmioaddr = 0;
}
Bit32u bx_svga_cirrus_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
Bit32u bx_svga_cirrus_c::pci_read_handler(Bit8u address, unsigned io_len)
{
#if !BX_USE_CIRRUS_SMF
return ((bx_svga_cirrus_c *)this_ptr)->pci_read(address,io_len);
}
Bit32u bx_svga_cirrus_c::pci_read(Bit8u address, unsigned io_len)
{
#endif // !BX_USE_CIRRUS_SMF
if (io_len > 4) {
BX_PANIC(("pci_read: io_len > 4!"));
return 0xffffffff;
@ -2298,15 +2290,8 @@ Bit32u bx_svga_cirrus_c::pci_read(Bit8u address, unsigned io_len)
return ret;
}
void bx_svga_cirrus_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
void bx_svga_cirrus_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_CIRRUS_SMF
((bx_svga_cirrus_c *)this_ptr)->pci_write(address,value,io_len);
}
void bx_svga_cirrus_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
{
#endif // !BX_USE_CIRRUS_SMF
unsigned i;
unsigned write_addr;
Bit8u new_value, old_value;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: svga_cirrus.h,v 1.6 2005-11-27 17:49:59 vruppert Exp $
// $Id: svga_cirrus.h,v 1.7 2006-03-07 21:11:20 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Makoto Suzuki (suzu)
@ -58,13 +58,17 @@ typedef void (*bx_cirrus_bitblt_rop_t)(
int dstpitch,int srcpitch,
int bltwidth,int bltheight);
class bx_svga_cirrus_c : public bx_vga_c {
class bx_svga_cirrus_c : public bx_vga_c
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
, public bx_pci_device_stub_c
#endif
{
public:
bx_svga_cirrus_c(void);
~bx_svga_cirrus_c();
bx_svga_cirrus_c();
virtual ~bx_svga_cirrus_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void init(void);
virtual void reset(unsigned type);
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);
virtual Bit8u mem_read(Bit32u addr);
@ -76,6 +80,11 @@ public:
virtual void trigger_timer(void *this_ptr);
virtual Bit8u get_actl_palette_idx(Bit8u index);
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
#endif
private:
static Bit32u svga_read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void svga_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
@ -164,22 +173,22 @@ private:
struct {
Bit8u index;
Bit8u reg[CIRRUS_CRTC_MAX+1];
} crtc; // 0x3b4-5/0x3d4-5
} crtc; // 0x3b4-5/0x3d4-5
struct {
Bit8u index;
Bit8u reg[CIRRUS_SEQENCER_MAX+1];
} sequencer; // 0x3c4-5
} sequencer; // 0x3c4-5
struct {
Bit8u index;
Bit8u reg[CIRRUS_CONTROL_MAX+1];
Bit8u shadow_reg0;
Bit8u shadow_reg1;
} control; // 0x3ce-f
} control; // 0x3ce-f
struct {
unsigned lockindex;
Bit8u data;
Bit8u palette[48];
} hidden_dac; // 0x3c6
} hidden_dac; // 0x3c6
bx_bool svga_unlock_special;
bx_bool svga_needs_update_tile;
@ -247,15 +256,9 @@ private:
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
BX_CIRRUS_SMF void svga_init_pcihandlers(void);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
BX_CIRRUS_SMF bx_bool cirrus_mem_read_handler(unsigned long addr, unsigned long len, void *data, void *param);
BX_CIRRUS_SMF bx_bool cirrus_mem_write_handler(unsigned long addr, unsigned long len, void *data, void *param);
#if !BX_USE_CIRRUS_SMF
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif // !BX_USE_CIRRUS_SMF
Bit8u pci_conf[256];
Bit32u pci_memaddr;
Bit32u pci_mmioaddr;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: unmapped.h,v 1.11 2006-03-07 18:16:41 sshwarts Exp $
// $Id: unmapped.h,v 1.12 2006-03-07 21:11:20 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -38,8 +38,7 @@
class bx_unmapped_c : public bx_devmodel_c {
public:
bx_unmapped_c();
~bx_unmapped_c();
virtual ~bx_unmapped_c();
virtual void init(void);
virtual void reset (unsigned type);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.cc,v 1.127 2006-03-01 17:14:36 vruppert Exp $
// $Id: vga.cc,v 1.128 2006-03-07 21:11:20 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -96,13 +96,12 @@ libvga_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv
return(0); // Success
}
void
libvga_LTX_plugin_fini(void)
void libvga_LTX_plugin_fini(void)
{
}
#endif // BX_SUPPORT_CLGD54XX
bx_vga_c::bx_vga_c(void)
bx_vga_c::bx_vga_c()
{
put("VGA");
s.vga_mem_updated = 0;
@ -114,8 +113,7 @@ bx_vga_c::bx_vga_c(void)
#endif
}
bx_vga_c::~bx_vga_c(void)
bx_vga_c::~bx_vga_c()
{
#if BX_SUPPORT_VBE
if (s.vbe_memory != NULL) {
@ -124,9 +122,7 @@ bx_vga_c::~bx_vga_c(void)
#endif
}
void
bx_vga_c::init(void)
void bx_vga_c::init(void)
{
unsigned i,string_i;
unsigned x,y;
@ -189,7 +185,7 @@ bx_vga_c::init(void)
BX_VGA_THIS s.pel.data[i].red = 0;
BX_VGA_THIS s.pel.data[i].green = 0;
BX_VGA_THIS s.pel.data[i].blue = 0;
}
}
BX_VGA_THIS s.pel.write_data_register = 0;
BX_VGA_THIS s.pel.write_data_cycle = 0;
BX_VGA_THIS s.pel.read_data_register = 0;
@ -215,13 +211,13 @@ bx_vga_c::init(void)
BX_VGA_THIS s.graphics_ctrl.bitmask = 0;
for (i=0; i<4; i++) {
BX_VGA_THIS s.graphics_ctrl.latch[i] = 0;
}
}
BX_VGA_THIS s.sequencer.index = 0;
BX_VGA_THIS s.sequencer.map_mask = 0;
for (i=0; i<4; i++) {
BX_VGA_THIS s.sequencer.map_mask_bit[i] = 0;
}
}
BX_VGA_THIS s.sequencer.reset1 = 1;
BX_VGA_THIS s.sequencer.reset2 = 1;
BX_VGA_THIS s.sequencer.reg1 = 0;
@ -343,41 +339,38 @@ bx_vga_c::init(void)
#endif
}
void
bx_vga_c::init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_write)
void bx_vga_c::init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_write)
{
unsigned addr, i;
Bit8u io_mask[16] = {3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1};
for (addr=0x03B4; addr<=0x03B5; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 1);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
}
for (addr=0x03BA; addr<=0x03BA; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 1);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
}
i = 0;
for (addr=0x03C0; addr<=0x03CF; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", io_mask[i++]);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
}
for (addr=0x03D4; addr<=0x03D5; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 3);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
}
for (addr=0x03DA; addr<=0x03DA; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 1);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
}
}
void
bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer, param_event_handler f_param)
void bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer, param_event_handler f_param)
{
bx_param_num_c *vga_update_interval = SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL);
BX_INFO(("interval=%u", vga_update_interval->get()));
@ -389,8 +382,7 @@ bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer, param_event_handler f_par
}
}
void
bx_vga_c::reset(unsigned type)
void bx_vga_c::reset(unsigned type)
{
if (!BX_VGA_THIS extension_checked) {
char *strptr = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
@ -415,69 +407,64 @@ bx_vga_c::determine_screen_dimensions(unsigned *piHeight, unsigned *piWidth)
h = (ai[1] + 1) * 8;
v = (ai[18] | ((ai[7] & 0x02) << 7) | ((ai[7] & 0x40) << 3)) + 1;
if ( BX_VGA_THIS s.graphics_ctrl.shift_reg == 0 )
{
if (BX_VGA_THIS s.graphics_ctrl.shift_reg == 0)
{
*piWidth = 640;
*piHeight = 480;
if ( BX_VGA_THIS s.CRTC.reg[6] == 0xBF )
{
{
if (BX_VGA_THIS s.CRTC.reg[23] == 0xA3 &&
BX_VGA_THIS s.CRTC.reg[20] == 0x40 &&
BX_VGA_THIS s.CRTC.reg[9] == 0x41)
{
{
*piWidth = 320;
*piHeight = 240;
}
}
else {
if (BX_VGA_THIS s.x_dotclockdiv2) h <<= 1;
*piWidth = h;
*piHeight = v;
}
}
}
else if ((h >= 640) && (v >= 480)) {
*piWidth = h;
*piHeight = v;
}
}
else if ( BX_VGA_THIS s.graphics_ctrl.shift_reg == 2 )
}
else if (BX_VGA_THIS s.graphics_ctrl.shift_reg == 2)
{
if ( BX_VGA_THIS s.sequencer.chain_four )
{
*piWidth = h;
*piHeight = v;
}
else
{
*piWidth = h;
*piHeight = v;
}
}
else
if (BX_VGA_THIS s.sequencer.chain_four)
{
*piWidth = h;
*piHeight = v;
}
else
{
*piWidth = h;
*piHeight = v;
}
}
else
{
if (BX_VGA_THIS s.x_dotclockdiv2) h <<= 1;
*piWidth = h;
*piHeight = v;
}
}
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_vga_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_vga_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_VGA_SMF
bx_vga_c *class_ptr = (bx_vga_c *) this_ptr;
return( class_ptr->read(address, io_len) );
return class_ptr->read(address, io_len);
}
Bit32u
bx_vga_c::read(Bit32u address, unsigned io_len)
Bit32u bx_vga_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -507,9 +494,9 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
#ifdef __OS2__
if ( bx_options.videomode == BX_VIDEO_DIRECT )
{
{
return _inp(address);
}
}
#endif
#if !defined(VGA_TRACE_FEATURE)
@ -572,11 +559,11 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
(BX_VGA_THIS s.attribute_ctrl.video_enabled << 5) |
BX_VGA_THIS s.attribute_ctrl.address;
RETURN(retval);
}
}
else {
BX_ERROR(("io read: 0x3c0: flip_flop != 0"));
return(0);
}
}
break;
case 0x03c1: /* */
@ -615,7 +602,7 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
BX_INFO(("io read: 0x3c1: unknown register 0x%02x",
(unsigned) BX_VGA_THIS s.attribute_ctrl.address));
RETURN(0);
}
}
break;
case 0x03c2: /* Input Status 0 */
@ -688,16 +675,16 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
break;
default:
retval = 0; // keep compiler happy
}
}
BX_VGA_THIS s.pel.read_data_cycle++;
if (BX_VGA_THIS s.pel.read_data_cycle >= 3) {
BX_VGA_THIS s.pel.read_data_cycle = 0;
BX_VGA_THIS s.pel.read_data_register++;
}
}
}
}
else {
retval = 0x3f;
}
}
RETURN(retval);
break;
@ -771,7 +758,7 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
BX_DEBUG(("io read: 0x3cf: index %u unhandled",
(unsigned) BX_VGA_THIS s.graphics_ctrl.index));
RETURN(0);
}
}
break;
case 0x03d4: /* CRTC Index Register (color emulation modes) */
@ -793,7 +780,7 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
default:
BX_INFO(("io read from vga port 0x%04x", (unsigned) address));
RETURN(0); /* keep compiler happy */
}
}
#if defined(VGA_TRACE_FEATURE)
read_return:
@ -809,15 +796,13 @@ bx_vga_c::read(Bit32u address, unsigned io_len)
#undef RETURN
#endif
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_vga_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_vga_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_VGA_SMF
bx_vga_c *class_ptr = (bx_vga_c *) this_ptr;
class_ptr->write(address, value, io_len, 0);
#else
UNUSED(this_ptr);
@ -825,12 +810,10 @@ bx_vga_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned i
#endif
}
void
bx_vga_c::write_handler_no_log(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_vga_c::write_handler_no_log(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_VGA_SMF
bx_vga_c *class_ptr = (bx_vga_c *) this_ptr;
class_ptr->write(address, value, io_len, 1);
#else
UNUSED(this_ptr);
@ -838,8 +821,7 @@ bx_vga_c::write_handler_no_log(void *this_ptr, Bit32u address, Bit32u value, uns
#endif
}
void
bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
void bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
{
unsigned i;
Bit8u charmap1, charmap2, prev_memory_mapping;
@ -875,14 +857,14 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
bx_vga_c::write(address+1, (value >> 8) & 0xff, 1, 1);
#endif
return;
}
}
#ifdef __OS2__
if ( bx_options.videomode == BX_VIDEO_DIRECT )
{
{
_outp(address,value);
return;
}
}
#endif
if ( (address >= 0x03b0) && (address <= 0x03bf) &&
@ -927,8 +909,8 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
default:
BX_DEBUG(("io write 0x3c0: address mode reg=0x%02x",
(unsigned) value));
}
}
}
else { /* data-write mode */
switch (BX_VGA_THIS s.attribute_ctrl.address) {
case 0x00: case 0x01: case 0x02: case 0x03:
@ -1005,8 +987,8 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
default:
BX_DEBUG(("io write 0x3c0: data-write mode 0x%02x",
(unsigned) BX_VGA_THIS s.attribute_ctrl.address));
}
}
}
BX_VGA_THIS s.attribute_ctrl.flip_flop = !BX_VGA_THIS s.attribute_ctrl.flip_flop;
break;
@ -1045,7 +1027,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
case 0x03c4: /* Sequencer Index Register */
if (value > 4) {
BX_DEBUG(("io write 3c4: value > 4"));
}
}
BX_VGA_THIS s.sequencer.index = value;
break;
@ -1090,7 +1072,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
bx_gui->set_text_charmap(
& BX_VGA_THIS s.vga_memory[0x20000 + BX_VGA_THIS s.charmap_address]);
BX_VGA_THIS s.vga_mem_updated = 1;
}
}
if (charmap2 != charmap1)
BX_INFO(("char map select: map #2 in block #%d unused", charmap2));
break;
@ -1112,7 +1094,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
default:
BX_DEBUG(("io write 0x3c5: index 0x%02x unhandled",
(unsigned) BX_VGA_THIS s.sequencer.index));
}
}
break;
case 0x03c6: /* PEL mask */
@ -1162,7 +1144,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
}
#endif
break;
}
}
BX_VGA_THIS s.pel.write_data_cycle++;
if (BX_VGA_THIS s.pel.write_data_cycle >= 3) {
@ -1173,7 +1155,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
// (unsigned) BX_VGA_THIS s.pel.data[BX_VGA_THIS s.pel.write_data_register].blue);
BX_VGA_THIS s.pel.write_data_cycle = 0;
BX_VGA_THIS s.pel.write_data_register++;
}
}
break;
case 0x03ca: /* Graphics 2 Position (EGA) */
@ -1263,7 +1245,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
/* ??? */
BX_DEBUG(("io write: 0x3cf: index %u unhandled",
(unsigned) BX_VGA_THIS s.graphics_ctrl.index));
}
}
break;
case 0x03b4: /* CRTC Index Register (monochrome emulation modes) */
@ -1369,7 +1351,8 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
default:
BX_ERROR(("unsupported io write to port 0x%04x, val=0x%02x",
(unsigned) address, (unsigned) value));
}
}
if (needs_update) {
// Mark all video as updated so the changes will go through
BX_VGA_THIS redraw_area(0, 0, old_iWidth, old_iHeight);
@ -1387,24 +1370,19 @@ Bit64s bx_vga_c::vga_param_handler(bx_param_c *param, int set, Bit64s val)
return val;
}
void
bx_vga_c::trigger_timer(void *this_ptr)
void bx_vga_c::trigger_timer(void *this_ptr)
{
timer_handler(this_ptr);
}
void
bx_vga_c::timer_handler(void *this_ptr)
void bx_vga_c::timer_handler(void *this_ptr)
{
#if !BX_USE_VGA_SMF
bx_vga_c *class_ptr = (bx_vga_c *) this_ptr;
class_ptr->timer();
}
void
bx_vga_c::timer(void)
void bx_vga_c::timer(void)
{
#else
UNUSED(this_ptr);
@ -1412,12 +1390,9 @@ bx_vga_c::timer(void)
update();
bx_gui->flush();
}
void
bx_vga_c::update(void)
void bx_vga_c::update(void)
{
unsigned iHeight, iWidth;
@ -2035,9 +2010,7 @@ bx_vga_c::update(void)
}
}
bx_bool
bx_vga_c::mem_read_handler(unsigned long addr, unsigned long len,
bx_bool bx_vga_c::mem_read_handler(unsigned long addr, unsigned long len,
void *data, void *param)
{
Bit8u *data_ptr;
@ -2059,8 +2032,7 @@ bx_vga_c::mem_read_handler(unsigned long addr, unsigned long len,
return 1;
}
Bit8u
bx_vga_c::mem_read(Bit32u addr)
Bit8u bx_vga_c::mem_read(Bit32u addr)
{
Bit32u offset;
Bit8u *plane0, *plane1, *plane2, *plane3;
@ -2087,14 +2059,12 @@ bx_vga_c::mem_read(Bit32u addr)
#error Fix the code for plugins
#endif
if ( bx_options.videomode == BX_VIDEO_DIRECT )
{
if (bx_options.videomode == BX_VIDEO_DIRECT)
{
char value;
value = devices->mem->video[addr-0xA0000];
return value;
}
}
#endif
switch (BX_VGA_THIS s.graphics_ctrl.memory_mapping) {
@ -2177,11 +2147,10 @@ bx_vga_c::mem_read(Bit32u addr)
break;
default:
return 0;
}
}
}
bx_bool
bx_vga_c::mem_write_handler(unsigned long addr, unsigned long len,
bx_bool bx_vga_c::mem_write_handler(unsigned long addr, unsigned long len,
void *data, void *param)
{
Bit8u *data_ptr;
@ -2203,8 +2172,7 @@ bx_vga_c::mem_write_handler(unsigned long addr, unsigned long len,
return 1;
}
void
bx_vga_c::mem_write(Bit32u addr, Bit8u value)
void bx_vga_c::mem_write(Bit32u addr, Bit8u value)
{
Bit32u offset;
Bit8u new_val[4];
@ -2215,12 +2183,12 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
// if in a vbe enabled mode, write to the vbe_memory
if ((BX_VGA_THIS s.vbe_enabled) && (BX_VGA_THIS s.vbe_bpp != VBE_DISPI_BPP_4))
{
vbe_mem_write(addr,value);
return;
vbe_mem_write(addr,value);
return;
}
else if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
{
return;
return;
}
#endif
@ -2234,12 +2202,11 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
#error Fix the code for plugins
#endif
if ( bx_options.videomode == BX_VIDEO_DIRECT )
{
if (bx_options.videomode == BX_VIDEO_DIRECT)
{
devices->mem->video[addr-0xA0000] = value;
return;
}
}
#endif
switch (BX_VGA_THIS s.graphics_ctrl.memory_mapping) {
@ -2470,7 +2437,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
case 1: /* write mode 1 */
for (i=0; i<4; i++ ) {
new_val[i] = BX_VGA_THIS s.graphics_ctrl.latch[i];
}
}
break;
case 2: /* write mode 2 */
@ -2659,8 +2626,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
}
}
void
bx_vga_c::get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
void bx_vga_c::get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
unsigned *txWidth)
{
unsigned VDE, MSL;
@ -2677,14 +2643,12 @@ bx_vga_c::get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
}
}
Bit8u
bx_vga_c::get_actl_palette_idx(Bit8u index)
Bit8u bx_vga_c::get_actl_palette_idx(Bit8u index)
{
return BX_VGA_THIS s.attribute_ctrl.palette_reg[index];
}
void
bx_vga_c::dump_status(void)
void bx_vga_c::dump_status(void)
{
#if BX_DEBUGGER
dbg_printf("s.misc_output.color_emulation = %u\n",
@ -2709,7 +2673,7 @@ bx_vga_c::dump_status(void)
case 2: dbg_printf("(350 lines)\n"); break;
case 3: dbg_printf("(480 lines)\n"); break;
default: dbg_printf("(reserved)\n");
}
}
dbg_printf("s.graphics_ctrl.odd_even = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.odd_even);
@ -2726,7 +2690,7 @@ bx_vga_c::dump_status(void)
case 2: dbg_printf("(B0000-B7FFF)\n"); break;
case 3: dbg_printf("(B8000-BFFFF)\n"); break;
default: dbg_printf("(A0000-BFFFF)\n"); break;
}
}
dbg_printf("s.sequencer.extended_mem = %u\n",
(unsigned) BX_VGA_THIS s.sequencer.extended_mem);
@ -2748,9 +2712,7 @@ bx_vga_c::dump_status(void)
#endif
}
void
bx_vga_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
void bx_vga_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
unsigned height)
{
unsigned xti, yti, xt0, xt1, yt0, yt1, xmax, ymax;
@ -2890,8 +2852,7 @@ bx_vga_c::vbe_mem_write(Bit32u addr, Bit8u value)
}
}
Bit32u
bx_vga_c::vbe_read_handler(void *this_ptr, Bit32u address, unsigned io_len)
Bit32u bx_vga_c::vbe_read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_VGA_SMF
bx_vga_c *class_ptr = (bx_vga_c *) this_ptr;
@ -2899,9 +2860,7 @@ bx_vga_c::vbe_read_handler(void *this_ptr, Bit32u address, unsigned io_len)
return( class_ptr->vbe_read(address, io_len) );
}
Bit32u
bx_vga_c::vbe_read(Bit32u address, unsigned io_len)
Bit32u bx_vga_c::vbe_read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
@ -3001,8 +2960,7 @@ bx_vga_c::vbe_read(Bit32u address, unsigned io_len)
return 0; /* keep compiler happy */
}
void
bx_vga_c::vbe_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
void bx_vga_c::vbe_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_VGA_SMF
bx_vga_c *class_ptr = (bx_vga_c *) this_ptr;
@ -3010,8 +2968,7 @@ bx_vga_c::vbe_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsign
class_ptr->vbe_write(address, value, io_len);
}
Bit32u
bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.h,v 1.51 2006-03-07 18:16:41 sshwarts Exp $
// $Id: vga.h,v 1.52 2006-03-07 21:11:20 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -132,9 +132,8 @@
class bx_vga_c : public bx_vga_stub_c {
public:
bx_vga_c(void);
~bx_vga_c(void);
bx_vga_c();
virtual ~bx_vga_c();
virtual void init(void);
virtual void reset(unsigned type);
BX_VGA_SMF bx_bool mem_read_handler(unsigned long addr, unsigned long len, void *data, void *param);

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// $Id: virt_timer.cc,v 1.26 2006-02-19 15:43:03 vruppert Exp $
// $Id: virt_timer.cc,v 1.27 2006-03-07 21:11:20 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -130,7 +130,7 @@ bx_virt_timer_c bx_virt_timer;
#define TICKS_TO_USEC(a) ( ((a)*usec_per_second)/ticks_per_second )
#define USEC_TO_TICKS(a) ( ((a)*ticks_per_second)/usec_per_second )
bx_virt_timer_c::bx_virt_timer_c( void )
bx_virt_timer_c::bx_virt_timer_c()
{
put("VTIMER");
settype(VTIMERLOG);
@ -147,21 +147,15 @@ bx_virt_timer_c::bx_virt_timer_c( void )
init_done = 0;
}
bx_virt_timer_c::~bx_virt_timer_c( void )
{
}
const Bit64u bx_virt_timer_c::NullTimerInterval = BX_MAX_VIRTUAL_TIME;
void
bx_virt_timer_c::nullTimer(void* this_ptr) {
void bx_virt_timer_c::nullTimer(void* this_ptr)
{
UNUSED(this_ptr);
}
void
bx_virt_timer_c::periodic(Bit64u time_passed) {
void bx_virt_timer_c::periodic(Bit64u time_passed)
{
//Assert that we haven't skipped any events.
BX_ASSERT (time_passed <= timers_next_event_time);
BX_ASSERT(!in_timer_handler);
@ -215,8 +209,8 @@ bx_virt_timer_c::periodic(Bit64u time_passed) {
//Get the current virtual time.
// This may return the same value on subsequent calls.
Bit64u
bx_virt_timer_c::time_usec(void) {
Bit64u bx_virt_timer_c::time_usec(void)
{
if(!use_virtual_timers) {
return bx_pc_system.time_usec();
}
@ -234,8 +228,8 @@ bx_virt_timer_c::time_usec(void) {
//Get the current virtual time.
// This will return a monotonically increasing value.
// MUST NOT be called from within a timer interrupt.
Bit64u
bx_virt_timer_c::time_usec_sequential(void) {
Bit64u bx_virt_timer_c::time_usec_sequential(void)
{
if(!use_virtual_timers) {
return bx_pc_system.time_usec_sequential();
}
@ -253,14 +247,13 @@ bx_virt_timer_c::time_usec_sequential(void) {
}
//Register a timer handler to go off after a given interval.
//Register a timer handler to go off with a periodic interval.
int
bx_virt_timer_c::register_timer( void *this_ptr, bx_timer_handler_t handler,
int bx_virt_timer_c::register_timer( void *this_ptr, bx_timer_handler_t handler,
Bit32u useconds,
bx_bool continuous, bx_bool active,
const char *id) {
const char *id)
{
if(!use_virtual_timers) {
return bx_pc_system.register_timer(this_ptr, handler, useconds,
continuous, active, id);
@ -299,8 +292,8 @@ bx_virt_timer_c::register_timer( void *this_ptr, bx_timer_handler_t handler,
}
//unregister a previously registered timer.
unsigned
bx_virt_timer_c::unregisterTimer(int timerID) {
unsigned bx_virt_timer_c::unregisterTimer(int timerID)
{
if(!use_virtual_timers) {
return bx_pc_system.unregisterTimer(timerID);
}
@ -311,16 +304,15 @@ bx_virt_timer_c::unregisterTimer(int timerID) {
if (timer[timerID].active) {
BX_PANIC(("unregisterTimer: timer '%s' is still active!", timer[timerID].id));
return(0); // Fail.
}
}
//No need to prevent doing this to unused timers.
timer[timerID].inUse = 0;
return(1);
}
void
bx_virt_timer_c::start_timers(void) {
void bx_virt_timer_c::start_timers(void)
{
if(!use_virtual_timers) {
bx_pc_system.start_timers();
return;
@ -329,9 +321,9 @@ bx_virt_timer_c::start_timers(void) {
}
//activate a deactivated but registered timer.
void
bx_virt_timer_c::activate_timer( unsigned timer_index, Bit32u useconds,
bx_bool continuous ) {
void bx_virt_timer_c::activate_timer(unsigned timer_index, Bit32u useconds,
bx_bool continuous)
{
if(!use_virtual_timers) {
bx_pc_system.activate_timer(timer_index, useconds, continuous);
return;
@ -356,8 +348,8 @@ bx_virt_timer_c::activate_timer( unsigned timer_index, Bit32u useconds,
}
//deactivate (but don't unregister) a currently registered timer.
void
bx_virt_timer_c::deactivate_timer( unsigned timer_index ) {
void bx_virt_timer_c::deactivate_timer( unsigned timer_index )
{
if(!use_virtual_timers) {
bx_pc_system.deactivate_timer(timer_index);
return;
@ -370,8 +362,8 @@ bx_virt_timer_c::deactivate_timer( unsigned timer_index ) {
timer[timer_index].active = 0;
}
void
bx_virt_timer_c::advance_virtual_time(Bit64u time_passed) {
void bx_virt_timer_c::advance_virtual_time(Bit64u time_passed)
{
BX_ASSERT(time_passed <= virtual_next_event_time);
current_virtual_time += time_passed;
@ -383,8 +375,8 @@ bx_virt_timer_c::advance_virtual_time(Bit64u time_passed) {
}
//Called when next_event_time changes.
void
bx_virt_timer_c::next_event_time_update(void) {
void bx_virt_timer_c::next_event_time_update(void)
{
virtual_next_event_time = timers_next_event_time + current_timers_time - current_virtual_time;
if(init_done) {
bx_pc_system.deactivate_timer(system_timer_id);
@ -395,9 +387,8 @@ bx_virt_timer_c::next_event_time_update(void) {
}
}
void
bx_virt_timer_c::init(void) {
void bx_virt_timer_c::init(void)
{
if ( (SIM->get_param_enum(BXPN_CLOCK_SYNC)->get()!=BX_CLOCK_SYNC_REALTIME)
&& (SIM->get_param_enum(BXPN_CLOCK_SYNC)->get()!=BX_CLOCK_SYNC_BOTH) )
virtual_timers_realtime = 0;
@ -434,8 +425,8 @@ bx_virt_timer_c::init(void) {
init_done = 1;
}
void
bx_virt_timer_c::timer_handler(void) {
void bx_virt_timer_c::timer_handler(void)
{
if(!virtual_timers_realtime) {
Bit64u temp_final_time = bx_pc_system.time_usec();
temp_final_time-=current_virtual_time;
@ -544,11 +535,10 @@ bx_virt_timer_c::timer_handler(void) {
bx_pc_system.activate_timer(system_timer_id,
(Bit32u)BX_MIN(0x7FFFFFFF,BX_MAX(1,TICKS_TO_USEC(virtual_next_event_time))),
0);
}
void
bx_virt_timer_c::pc_system_timer_handler(void* this_ptr) {
void bx_virt_timer_c::pc_system_timer_handler(void* this_ptr)
{
((bx_virt_timer_c *)this_ptr)->timer_handler();
}

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// $Id: virt_timer.h,v 1.8 2006-01-18 18:35:38 sshwarts Exp $
// $Id: virt_timer.h,v 1.9 2006-03-07 21:11:20 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -108,8 +108,8 @@ private:
public:
bx_virt_timer_c(void);
~bx_virt_timer_c(void);
bx_virt_timer_c();
virtual ~bx_virt_timer_c() {}
//Get the current virtual time.
// This may return the same value on subsequent calls.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: plugin.h,v 1.49 2006-02-27 19:04:00 sshwarts Exp $
// $Id: plugin.h,v 1.50 2006-03-07 21:11:12 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// This file provides macros and types needed for plugins. It is based on
@ -176,8 +176,8 @@ extern "C" {
#define DEV_vga_dump_status() (bx_devices.pluginVgaDevice->dump_status())
///////// PCI macros
#define DEV_register_pci_handlers(b,c,d,e,f,g) \
(bx_devices.pluginPciBridge->register_pci_handlers(b,c,d,e,f,g))
#define DEV_register_pci_handlers(a,b,c,d) \
(bx_devices.pluginPciBridge->register_pci_handlers(a,b,c,d))
#define DEV_is_pci_device(name) bx_devices.pluginPciBridge->is_pci_device(name)
#define DEV_pci_set_irq(a,b,c) bx_devices.pluginPci2IsaBridge->pci_set_irq(a,b,c)
#define DEV_pci_set_base_mem(a,b,c,d,e,f) \