applied slowdown timer crosscompile fix

This commit is contained in:
Jeroen Janssen 2003-08-20 06:26:27 +00:00
parent 17bbc9ddfb
commit 5a023a8ad5
3 changed files with 27 additions and 8 deletions

View File

@ -909,4 +909,7 @@ typedef
// of instructions.
//#define BX_SCHEDULED_DIE_TIME 1162230000 // end of redhat6.0 boot
#define BX_HAVE_MSLEEP 0
#endif // _BX_CONFIG_H

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: slowdown_timer.cc,v 1.14 2003-08-19 00:10:38 cbothamy Exp $
// $Id: slowdown_timer.cc,v 1.15 2003-08-20 06:26:27 japj Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -36,6 +36,9 @@
#define sectousec(a) ((a)*SECINUSEC)
#define nsectousec(a) ((a)/1000)
#define MSECINUSEC 1000
#define usectomsec(a) ((a)/MSECINUSEC)
#if BX_HAVE_USLEEP
# define Qval 1000
#else
@ -140,12 +143,15 @@ bx_slowdown_timer_c::handle_timer() {
* ^>Bochs runs at normal
*/
if(wanttime > (totaltime+REALTIME_Q)) {
#if BX_HAVE_USLEEP
usleep(s.Q);
#else
sleep(usectosec(s.Q));
#endif
//delay(wanttime-totaltime);
#if BX_HAVE_USLEEP
usleep(s.Q);
#elif BX_HAVE_MSLEEP
msleep(usectomsec(s.Q));
#elif BX_HAVE_SLEEP
sleep(usectosec(s.Q));
#else
#error do not know have to sleep
#endif //delay(wanttime-totaltime);
/*alternatively: delay(Q);
* This works okay because we share the delay between
* two time quantums.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: osdep.h,v 1.18 2003-06-07 19:16:51 vruppert Exp $
// $Id: osdep.h,v 1.19 2003-08-20 06:26:27 japj Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -159,6 +159,16 @@ typedef long ssize_t ;
extern Bit64u bx_get_realtime64_usec (void);
#endif
#ifdef WIN32
#undef BX_HAVE_MSLEEP
#define BX_HAVE_MSLEEP 1
#ifndef __MINGW32__
#define msleep(msec) _sleep(msec)
#else
#define msleep(msec) Sleep(msec)
#endif
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */