- removed exit() method from the devmodel object, since all that stuff can be
done by the object destructor (changes in cmos, hard drive and keyboard) - bx_unload_plugins() now deletes the devmodel object in non-plugin mode - CMOS device now prints the time on exit in human-readable format
This commit is contained in:
parent
0a804aeb18
commit
647b0e3e6c
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cmos.cc,v 1.57 2006-09-10 17:18:44 vruppert Exp $
|
||||
// $Id: cmos.cc,v 1.58 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -109,7 +109,6 @@ int libcmos_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char
|
||||
|
||||
void libcmos_LTX_plugin_fini(void)
|
||||
{
|
||||
theCmosDevice->exit();
|
||||
delete theCmosDevice;
|
||||
}
|
||||
|
||||
@ -127,12 +126,19 @@ bx_cmos_c::bx_cmos_c(void)
|
||||
|
||||
bx_cmos_c::~bx_cmos_c(void)
|
||||
{
|
||||
save_image();
|
||||
char *tmptime;
|
||||
if ((tmptime = strdup(ctime(&(BX_CMOS_THIS s.timeval)))) != NULL) {
|
||||
tmptime[strlen(tmptime)-1]='\0';
|
||||
BX_INFO(("Last time is %u (%s)", (unsigned) get_timeval(), tmptime));
|
||||
free(tmptime);
|
||||
}
|
||||
BX_DEBUG(("Exit"));
|
||||
}
|
||||
|
||||
void bx_cmos_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: cmos.cc,v 1.57 2006-09-10 17:18:44 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: cmos.cc,v 1.58 2006-09-16 14:47:40 vruppert Exp $"));
|
||||
// CMOS RAM & RTC
|
||||
|
||||
DEV_register_ioread_handler(this, read_handler, 0x0070, "CMOS RAM", 1);
|
||||
@ -269,12 +275,6 @@ void bx_cmos_c::reset(unsigned type)
|
||||
BX_CMOS_THIS CRA_change();
|
||||
}
|
||||
|
||||
void bx_cmos_c::exit(void)
|
||||
{
|
||||
BX_CMOS_THIS save_image();
|
||||
BX_INFO(("Last time is %u", (unsigned) BX_CMOS_THIS get_timeval()));
|
||||
}
|
||||
|
||||
void bx_cmos_c::save_image(void)
|
||||
{
|
||||
int fd, ret;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cmos.h,v 1.17 2006-09-10 17:18:44 vruppert Exp $
|
||||
// $Id: cmos.h,v 1.18 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -42,7 +42,6 @@ public:
|
||||
virtual ~bx_cmos_c();
|
||||
|
||||
virtual void init(void);
|
||||
virtual void exit(void);
|
||||
virtual void checksum_cmos(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void save_image(void);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.105 2006-09-13 18:51:25 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.106 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -114,7 +114,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.105 2006-09-13 18:51:25 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.106 2006-09-16 14:47:40 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set no-default handlers, will be overwritten by the real default handler */
|
||||
@ -391,8 +391,6 @@ void bx_devices_c::after_restore_state()
|
||||
|
||||
void bx_devices_c::exit()
|
||||
{
|
||||
if (DEV_hd_present())
|
||||
DEV_hd_close_harddrive();
|
||||
#if BX_SUPPORT_PCI
|
||||
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
|
||||
pluginPciBridge->print_i440fx_state();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.cc,v 1.184 2006-09-13 18:51:25 vruppert Exp $
|
||||
// $Id: harddrv.cc,v 1.185 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -123,6 +123,7 @@ bx_hard_drive_c::~bx_hard_drive_c()
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
for (Bit8u device=0; device<2; device ++) {
|
||||
if (channels[channel].drives[device].hard_drive != NULL) {
|
||||
channels[channel].drives[device].hard_drive->close();
|
||||
delete channels[channel].drives[device].hard_drive;
|
||||
channels[channel].drives[device].hard_drive = NULL;
|
||||
}
|
||||
@ -145,7 +146,7 @@ void bx_hard_drive_c::init(void)
|
||||
char ata_name[20];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.184 2006-09-13 18:51:25 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.185 2006-09-16 14:47:40 vruppert Exp $"));
|
||||
|
||||
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
sprintf(ata_name, "ata.%d.resources", channel);
|
||||
@ -2580,16 +2581,6 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
}
|
||||
|
||||
void bx_hard_drive_c::close_harddrive(void)
|
||||
{
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
if(BX_HD_THIS channels[channel].drives[0].hard_drive != NULL)
|
||||
BX_HD_THIS channels[channel].drives[0].hard_drive->close();
|
||||
if(BX_HD_THIS channels[channel].drives[1].hard_drive != NULL)
|
||||
BX_HD_THIS channels[channel].drives[1].hard_drive->close();
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool BX_CPP_AttrRegparmN(2)
|
||||
bx_hard_drive_c::calculate_logical_address(Bit8u channel, off_t *sector)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.h,v 1.44 2006-08-05 07:49:31 vruppert Exp $
|
||||
// $Id: harddrv.h,v 1.45 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -161,7 +161,6 @@ class bx_hard_drive_c : public bx_hard_drive_stub_c {
|
||||
public:
|
||||
bx_hard_drive_c();
|
||||
virtual ~bx_hard_drive_c();
|
||||
virtual void close_harddrive(void);
|
||||
virtual void init();
|
||||
virtual void reset(unsigned type);
|
||||
virtual Bit32u get_device_handle(Bit8u channel, Bit8u device);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.79 2006-09-13 18:51:25 vruppert Exp $
|
||||
// $Id: iodev.h,v 1.80 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -85,7 +85,6 @@ class BOCHSAPI bx_devmodel_c : public logfunctions {
|
||||
virtual void init_mem(BX_MEM_C *) {}
|
||||
virtual void init(void) {}
|
||||
virtual void reset(unsigned type) {}
|
||||
virtual void exit(void) {}
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
virtual void register_state(void) {}
|
||||
virtual void after_restore_state(void) {}
|
||||
@ -135,9 +134,6 @@ public:
|
||||
|
||||
class BOCHSAPI bx_hard_drive_stub_c : public bx_devmodel_c {
|
||||
public:
|
||||
virtual void close_harddrive(void) {
|
||||
STUBFUNC(HD, close_harddrive);
|
||||
}
|
||||
virtual void init() {
|
||||
STUBFUNC(HD, init);
|
||||
}
|
||||
@ -200,9 +196,6 @@ public:
|
||||
virtual void checksum_cmos(void) {
|
||||
STUBFUNC(cmos, checksum);
|
||||
}
|
||||
virtual void save_image(void) {
|
||||
STUBFUNC(cmos, save_image);
|
||||
}
|
||||
};
|
||||
|
||||
class BOCHSAPI bx_dma_stub_c : public bx_devmodel_c {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.cc,v 1.124 2006-09-12 13:05:07 vruppert Exp $
|
||||
// $Id: keyboard.cc,v 1.125 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -76,7 +76,6 @@ int libkeyboard_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, c
|
||||
|
||||
void libkeyboard_LTX_plugin_fini(void)
|
||||
{
|
||||
theKeyboard->exit();
|
||||
delete theKeyboard;
|
||||
}
|
||||
|
||||
@ -89,6 +88,18 @@ bx_keyb_c::bx_keyb_c()
|
||||
|
||||
bx_keyb_c::~bx_keyb_c()
|
||||
{
|
||||
// remove runtime parameter handler
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set_handler(NULL);
|
||||
SIM->get_param_num(BXPN_KBD_PASTE_DELAY)->set_handler(NULL);
|
||||
if (pastebuf != NULL) {
|
||||
delete [] pastebuf;
|
||||
}
|
||||
#if BX_WITH_WX
|
||||
bx_list_c *list = (bx_list_c*)SIM->get_param(BXPN_WX_KBD_STATE);
|
||||
if (list != NULL) {
|
||||
list->clear();
|
||||
}
|
||||
#endif
|
||||
BX_DEBUG(("Exit"));
|
||||
}
|
||||
|
||||
@ -115,7 +126,7 @@ void bx_keyb_c::resetinternals(bx_bool powerup)
|
||||
|
||||
void bx_keyb_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.124 2006-09-12 13:05:07 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.125 2006-09-16 14:47:40 vruppert Exp $"));
|
||||
Bit32u i;
|
||||
|
||||
DEV_register_irq(1, "8042 Keyboard controller");
|
||||
@ -263,22 +274,6 @@ void bx_keyb_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
void bx_keyb_c::exit(void)
|
||||
{
|
||||
// remove runtime parameter handler
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set_handler(NULL);
|
||||
SIM->get_param_num(BXPN_KBD_PASTE_DELAY)->set_handler(NULL);
|
||||
if (BX_KEY_THIS pastebuf != NULL) {
|
||||
delete [] BX_KEY_THIS pastebuf;
|
||||
}
|
||||
#if BX_WITH_WX
|
||||
bx_list_c *list = (bx_list_c*)SIM->get_param(BXPN_WX_KBD_STATE);
|
||||
if (list != NULL) {
|
||||
list->clear();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
void bx_keyb_c::register_state(void)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.h,v 1.38 2006-09-10 17:18:44 vruppert Exp $
|
||||
// $Id: keyboard.h,v 1.39 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -53,7 +53,6 @@ public:
|
||||
// implement bx_devmodel_c interface
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void exit(void);
|
||||
// override stubs from bx_keyb_stub_c
|
||||
virtual void gen_scancode(Bit32u key);
|
||||
virtual void paste_bytes(Bit8u *data, Bit32s length);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.342 2006-09-15 17:02:52 vruppert Exp $
|
||||
// $Id: main.cc,v 1.343 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -73,7 +73,6 @@ bx_bool bx_gui_sighandler = 0;
|
||||
Bit32u bx_unmapped_io_read_handler(Bit32u address, unsigned io_len);
|
||||
void bx_unmapped_io_write_handler(Bit32u address, Bit32u value,
|
||||
unsigned io_len);
|
||||
void bx_close_harddrive(void);
|
||||
#endif
|
||||
|
||||
void bx_init_bx_dbg (void);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.cc,v 1.20 2006-09-12 13:05:07 vruppert Exp $
|
||||
// $Id: plugin.cc,v 1.21 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file defines the plugin and plugin-device registration functions and
|
||||
@ -637,7 +637,7 @@ void bx_unload_plugins()
|
||||
bx_unload_plugin(device->name);
|
||||
#endif
|
||||
} else {
|
||||
device->devmodel->exit();
|
||||
delete device->devmodel;
|
||||
}
|
||||
next = device->next;
|
||||
free(device);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.h,v 1.53 2006-09-10 09:13:47 vruppert Exp $
|
||||
// $Id: plugin.h,v 1.54 2006-09-16 14:47:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file provides macros and types needed for plugins. It is based on
|
||||
@ -107,7 +107,6 @@ extern "C" {
|
||||
#define DEV_cmos_set_reg(a,b) (bx_devices.pluginCmosDevice->set_reg(a,b))
|
||||
#define DEV_cmos_checksum() (bx_devices.pluginCmosDevice->checksum_cmos())
|
||||
#define DEV_cmos_get_timeval() (bx_devices.pluginCmosDevice->get_timeval())
|
||||
#define DEV_cmos_save_image() (bx_devices.pluginCmosDevice->save_image())
|
||||
#define DEV_cmos_present() (bx_devices.pluginCmosDevice != &bx_devices.stubCmos)
|
||||
|
||||
///////// keyboard macros
|
||||
@ -133,7 +132,6 @@ extern "C" {
|
||||
(bx_devices.pluginHardDrive->get_cd_media_status(handle))
|
||||
#define DEV_hd_set_cd_media_status(handle, status) \
|
||||
(bx_devices.pluginHardDrive->set_cd_media_status(handle, status))
|
||||
#define DEV_hd_close_harddrive() bx_devices.pluginHardDrive->close_harddrive()
|
||||
#define DEV_hd_present() (bx_devices.pluginHardDrive != &bx_devices.stubHardDrive)
|
||||
#define DEV_hd_bmdma_read_sector(a,b,c) bx_devices.pluginHardDrive->bmdma_read_sector(a,b,c)
|
||||
#define DEV_hd_bmdma_write_sector(a,b) bx_devices.pluginHardDrive->bmdma_write_sector(a,b)
|
||||
|
Loading…
Reference in New Issue
Block a user