- moved some parts of the timer init from the constructor to initialize()

- exit() method sets the number of registered timers back to 1 (or 2 if APIC
  is present)
- fixed some parameter types for save/restore
- debug message for timer registration added
- slowdown timer: exit method added to reset the timer id
This commit is contained in:
Volker Ruppert 2006-09-16 19:30:56 +00:00
parent 647b0e3e6c
commit 4c1e82f18c
4 changed files with 28 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: devices.cc,v 1.106 2006-09-16 14:47:40 vruppert Exp $
// $Id: devices.cc,v 1.107 2006-09-16 19:30:56 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.106 2006-09-16 14:47:40 vruppert Exp $"));
BX_DEBUG(("Init $Id: devices.cc,v 1.107 2006-09-16 19:30:56 vruppert Exp $"));
mem = newmem;
/* set no-default handlers, will be overwritten by the real default handler */
@ -391,6 +391,8 @@ void bx_devices_c::after_restore_state()
void bx_devices_c::exit()
{
bx_slowdown_timer.exit();
#if BX_SUPPORT_PCI
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
pluginPciBridge->print_i440fx_state();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: slowdown_timer.cc,v 1.25 2006-05-27 15:54:49 sshwarts Exp $
// $Id: slowdown_timer.cc,v 1.26 2006-09-16 19:30:56 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -84,6 +84,11 @@ void bx_slowdown_timer_c::init(void)
bx_pc_system.activate_timer(s.timer_handle,(Bit32u)s.Q,0);
}
void bx_slowdown_timer_c::exit(void)
{
s.timer_handle = BX_NULL_TIMER_HANDLE;
}
#if BX_SUPPORT_SAVE_RESTORE
void bx_slowdown_timer_c::after_restore_state(void)
{

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: slowdown_timer.h,v 1.11 2006-05-27 15:54:49 sshwarts Exp $
// $Id: slowdown_timer.h,v 1.12 2006-09-16 19:30:56 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -45,6 +45,7 @@ public:
bx_slowdown_timer_c();
void init(void);
void exit(void);
#if BX_SUPPORT_SAVE_RESTORE
void after_restore_state(void);
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pc_system.cc,v 1.63 2006-09-07 18:50:51 vruppert Exp $
// $Id: pc_system.cc,v 1.64 2006-09-16 19:30:56 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -67,22 +67,22 @@ bx_pc_system_c::bx_pc_system_c()
ticksTotal = 0; // Reset ticks since emulator started.
timer[0].inUse = 1;
timer[0].period = NullTimerInterval;
timer[0].timeToFire = ticksTotal + NullTimerInterval;
timer[0].active = 1;
timer[0].continuous = 1;
timer[0].funct = nullTimer;
timer[0].this_ptr = this;
currCountdown = NullTimerInterval;
currCountdownPeriod = NullTimerInterval;
numTimers = 1; // So far, only the nullTimer.
triggeredTimer = 0;
lastTimeUsec = 0;
usecSinceLast = 0;
}
void bx_pc_system_c::initialize(Bit32u ips)
{
ticksTotal = 0;
timer[0].timeToFire = NullTimerInterval;
currCountdown = NullTimerInterval;
currCountdownPeriod = NullTimerInterval;
lastTimeUsec = 0;
usecSinceLast = 0;
triggeredTimer = 0;
HRQ = 0;
kill_bochs_request = 0;
@ -214,6 +214,8 @@ Bit8u bx_pc_system_c::IAC(void)
void bx_pc_system_c::exit(void)
{
// delete all registered timers (exception: null timer and APIC timer)
numTimers = 1 + BX_SUPPORT_APIC;
bx_devices.exit();
if (bx_gui) bx_gui->exit();
}
@ -224,12 +226,12 @@ void bx_pc_system_c::register_state(void)
bx_list_c *list = new bx_list_c(SIM->get_sr_root(), "pc_system", "PC System State", 8);
BXRS_PARAM_BOOL(list, enable_a20, enable_a20);
BXRS_HEX_PARAM_SIMPLE(list, currCountdown);
BXRS_HEX_PARAM_SIMPLE(list, currCountdownPeriod);
BXRS_HEX_PARAM_SIMPLE(list, ticksTotal);
BXRS_HEX_PARAM_SIMPLE(list, lastTimeUsec);
BXRS_HEX_PARAM_SIMPLE(list, usecSinceLast);
BXRS_HEX_PARAM_SIMPLE(list, HRQ);
BXRS_DEC_PARAM_SIMPLE(list, currCountdown);
BXRS_DEC_PARAM_SIMPLE(list, currCountdownPeriod);
BXRS_DEC_PARAM_SIMPLE(list, ticksTotal);
BXRS_DEC_PARAM_SIMPLE(list, lastTimeUsec);
BXRS_DEC_PARAM_SIMPLE(list, usecSinceLast);
BXRS_PARAM_BOOL(list, HRQ, HRQ);
bx_list_c *timers = new bx_list_c(list, "timer", numTimers);
for (unsigned i = 0; i < numTimers; i++) {
@ -310,6 +312,7 @@ int bx_pc_system_c::register_timer_ticks(void* this_ptr, bx_timer_handler_t func
}
}
BX_DEBUG(("timer id %d registered for '%s'", i, id));
// If we didn't find a free slot, increment the bound, numTimers.
if (i==numTimers)
numTimers++; // One new timer installed.