From ffc84c8be99d9119b83868415efb52c8fd16cb2c Mon Sep 17 00:00:00 2001 From: Bryce Denney Date: Sun, 1 Sep 2002 15:38:29 +0000 Subject: [PATCH] - add BX_SCHEDULED_DIE_TIME which causes Bochs to exit automatically after a certain number of instructions. I use it for performance testing, and it won't hurt anyone unless they are foolish enough to enable it in config.h. Of course it is disabled by default! --- bochs/config.h.in | 6 ++++++ bochs/iodev/pit_wrap.cc | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bochs/config.h.in b/bochs/config.h.in index c59767e8a..8f809c12a 100644 --- a/bochs/config.h.in +++ b/bochs/config.h.in @@ -620,4 +620,10 @@ typedef unsigned int Boolean; #define BX_CDROM_NAME "CD-ROM" #endif +// This is handy for certain performance testing purposes, but otherwise +// totally useless. If you define BX_SCHEDULED_DIE_TIME then it enables code +// in bx_pit_c::periodic that will cause Bochs to exit() after a certain number +// of instructions. +//#define BX_SCHEDULED_DIE_TIME 1162230000 // end of redhat6.0 boot + #endif // _BX_CONFIG_H diff --git a/bochs/iodev/pit_wrap.cc b/bochs/iodev/pit_wrap.cc index 5af2dec0e..2846f877e 100644 --- a/bochs/iodev/pit_wrap.cc +++ b/bochs/iodev/pit_wrap.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: pit_wrap.cc,v 1.20 2002-08-27 19:54:46 bdenney Exp $ +// $Id: pit_wrap.cc,v 1.21 2002-09-01 15:38:29 bdenney Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -404,6 +404,13 @@ bx_pit_c::periodic( Bit32u usec_delta ) Boolean want_interrupt = 0; Bit32u ticks_delta = 0; +#ifdef BX_SCHEDULED_DIE_TIME + if (bx_pc_system.time_ticks() > BX_SCHEDULED_DIE_TIME) { + BX_ERROR (("ticks exceeded scheduled die time, quitting")); + BX_EXIT (2); + } +#endif + #if BX_USE_REALTIME_PIT ticks_delta=(Bit32u)(USEC_TO_TICKS(usec_delta)); if((BX_PIT_THIS s.total_ticks + ticks_delta) < (BX_PIT_THIS s.max_ticks)) {