Update of /cvsroot/bochs/bochs/iodev
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28102/iodev
Modified Files:
devices.cc pit.cc pit.h pit_wrap.cc pit_wrap.h virt_timer.cc
virt_timer.h
Log Message:
- new PIT: exit method added to reset the timer id
- old PIT: exit method stub added and some code cleanup
- virtual timer: reset method added with basic init code from the constructor
Index: devices.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/devices.cc,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- devices.cc 16 Sep 2006 19:30:56 -0000 1.107
+++ devices.cc 17 Sep 2006 19:19:15 -0000 1.108
@@ -391,6 +391,8 @@
void bx_devices_c::exit()
{
+ pit->exit();
+ bx_virt_timer.reset();
bx_slowdown_timer.exit();
#if BX_SUPPORT_PCI
Index: pit.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/pit.cc,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- pit.cc 29 May 2006 22:33:38 -0000 1.23
+++ pit.cc 17 Sep 2006 19:19:15 -0000 1.24
@@ -142,25 +142,21 @@
#endif
-bx_pit_c::bx_pit_c( void )
+bx_pit_c::bx_pit_c(void)
{
put("PIT");
settype(PITLOG);
memset(&s, 0, sizeof(s));
/* 8254 PIT (Programmable Interval Timer) */
-
- BX_PIT_THIS s.timer_handle[1] = BX_NULL_TIMER_HANDLE;
- BX_PIT_THIS s.timer_handle[2] = BX_NULL_TIMER_HANDLE;
}
-bx_pit_c::~bx_pit_c( void )
+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);
@@ -223,6 +219,10 @@
return(1);
}
+int bx_pit_c::exit(void)
+{
+}
+
void bx_pit_c::reset(unsigned type)
{
}
Index: pit.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/pit.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- pit.h 27 May 2006 15:54:48 -0000 1.15
+++ pit.h 17 Sep 2006 19:19:15 -0000 1.16
@@ -65,6 +65,7 @@
bx_pit_c();
virtual ~bx_pit_c();
BX_PIT_SMF int init(void);
+ BX_PIT_SMF void exit(void);
BX_PIT_SMF void reset( unsigned type);
BX_PIT_SMF bx_bool periodic( Bit32u usec_delta );
#if BX_SUPPORT_SAVE_RESTORE
@@ -84,7 +85,6 @@
bx_pit_t timer[3];
Bit8u speaker_data_on;
bx_bool refresh_clock_div2;
- int timer_handle[3];
} s;
BX_PIT_SMF void write_count_reg( Bit8u value, unsigned timerid );
Index: pit_wrap.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/pit_wrap.cc,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- pit_wrap.cc 27 May 2006 15:54:48 -0000 1.62
+++ pit_wrap.cc 17 Sep 2006 19:19:15 -0000 1.63
@@ -124,7 +124,7 @@
BX_DEBUG(("pit: RESETting timer."));
bx_virt_timer.deactivate_timer(BX_PIT_THIS s.timer_handle[0]);
BX_DEBUG(("deactivated timer."));
- if(BX_PIT_THIS s.timer.get_next_event_time()) {
+ if (BX_PIT_THIS s.timer.get_next_event_time()) {
bx_virt_timer.activate_timer(BX_PIT_THIS s.timer_handle[0],
(Bit32u)BX_MAX(1,TICKS_TO_USEC(BX_PIT_THIS s.timer.get_next_event_time())),
0);
@@ -146,6 +146,12 @@
return(1);
}
+void bx_pit_c::exit(void)
+{
+ BX_PIT_THIS s.timer_handle[0] = BX_NULL_TIMER_HANDLE;
+ BX_PIT_THIS s.timer.init();
+}
+
void bx_pit_c::reset(unsigned type)
{
BX_PIT_THIS s.timer.reset(type);
Index: pit_wrap.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/pit_wrap.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- pit_wrap.h 27 May 2006 15:54:49 -0000 1.24
+++ pit_wrap.h 17 Sep 2006 19:19:15 -0000 1.25
@@ -50,6 +50,7 @@
bx_pit_c();
virtual ~bx_pit_c() {}
BX_PIT_SMF int init(void);
+ BX_PIT_SMF void exit(void);
BX_PIT_SMF void reset(unsigned type);
BX_PIT_SMF bx_bool periodic(Bit32u usec_delta);
#if BX_SUPPORT_SAVE_RESTORE
Index: virt_timer.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/virt_timer.cc,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- virt_timer.cc 29 May 2006 22:33:38 -0000 1.31
+++ virt_timer.cc 17 Sep 2006 19:19:15 -0000 1.32
@@ -135,16 +135,7 @@
put("VTIMER");
settype(VTIMERLOG);
- numTimers = 0;
- current_timers_time = 0;
- timers_next_event_time = BX_MAX_VIRTUAL_TIME;
- last_sequential_time = 0;
- in_timer_handler = 0;
- virtual_next_event_time = BX_MAX_VIRTUAL_TIME;
- current_virtual_time = 0;
-
- use_virtual_timers = BX_USE_VIRTUAL_TIMERS;
- init_done = 0;
+ reset();
}
const Bit64u bx_virt_timer_c::NullTimerInterval = BX_MAX_VIRTUAL_TIME;
@@ -384,6 +375,20 @@
}
}
+void bx_virt_timer_c::reset(void)
+{
+ numTimers = 0;
+ current_timers_time = 0;
+ timers_next_event_time = BX_MAX_VIRTUAL_TIME;
+ last_sequential_time = 0;
+ in_timer_handler = 0;
+ virtual_next_event_time = BX_MAX_VIRTUAL_TIME;
+ current_virtual_time = 0;
+
+ use_virtual_timers = BX_USE_VIRTUAL_TIMERS;
+ init_done = 0;
+}
+
void bx_virt_timer_c::init(void)
{
if ( (SIM->get_param_enum(BXPN_CLOCK_SYNC)->get()!=BX_CLOCK_SYNC_REALTIME)
Index: virt_timer.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/virt_timer.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- virt_timer.h 27 May 2006 15:54:49 -0000 1.11
+++ virt_timer.h 17 Sep 2006 19:19:15 -0000 1.12
@@ -145,7 +145,10 @@
//The real timer handler.
void timer_handler();
- //Initialization
+ //Initialization step #1
+ void reset(void);
+
+ //Initialization step #2
void init(void);
#if BX_SUPPORT_SAVE_RESTORE
|