- save/restore of the configuration implemented (in bochsrc format)

- don't load another config file if the restore flag is set
- disabled restore_hardware() for now (will be enabled when save/restore is
  complete and stable)
This commit is contained in:
Volker Ruppert 2006-04-07 12:49:50 +00:00
parent 6aadcd5208
commit 97520ff814
3 changed files with 24 additions and 11 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.136 2006-04-06 20:42:50 vruppert Exp $ // $Id: siminterface.cc,v 1.137 2006-04-07 12:49:50 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// See siminterface.h for description of the siminterface concept. // See siminterface.h for description of the siminterface concept.
@ -140,7 +140,7 @@ public:
virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []); virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []);
#if BX_SAVE_RESTORE #if BX_SAVE_RESTORE
// save/restore support // save/restore support
virtual bx_bool save_state(const char *checkpoint_name); virtual bx_bool save_state(const char *checkpoint_path);
virtual bx_bool restore_config(); virtual bx_bool restore_config();
virtual bx_bool restore_logopts(); virtual bx_bool restore_logopts();
virtual bx_bool restore_hardware(); virtual bx_bool restore_hardware();
@ -835,17 +835,24 @@ Bit32s bx_real_sim_c::parse_user_option(int idx, const char *context, int num_pa
} }
#if BX_SAVE_RESTORE #if BX_SAVE_RESTORE
bx_bool bx_real_sim_c::save_state(const char *checkpoint_name) bx_bool bx_real_sim_c::save_state(const char *checkpoint_path)
{ {
char config[BX_PATHNAME_LEN];
sprintf(config, "%s/config", checkpoint_path);
write_rc(config, 1);
// TODO // TODO
fprintf(stderr, "save_state (not implemented yet)\n"); fprintf(stderr, "save_state (not yet complete)\n");
return 0; return 0;
} }
bx_bool bx_real_sim_c::restore_config() bx_bool bx_real_sim_c::restore_config()
{ {
// TODO char config[BX_PATHNAME_LEN];
fprintf(stderr, "restore_config (not implemented yet)\n");
sprintf(config, "%s/config", get_param_string(BXPN_RESTORE_PATH)->getptr());
BX_INFO(("restoring '%s'", config));
read_rc(config);
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.182 2006-04-06 20:42:50 vruppert Exp $ // $Id: siminterface.h,v 1.183 2006-04-07 12:49:50 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Intro to siminterface by Bryce Denney: // Intro to siminterface by Bryce Denney:
@ -1181,7 +1181,7 @@ public:
virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []) {return -1;} virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []) {return -1;}
#if BX_SAVE_RESTORE #if BX_SAVE_RESTORE
// save/restore support // save/restore support
virtual bx_bool save_state(const char *checkpoint_name) {return 0;} virtual bx_bool save_state(const char *checkpoint_path) {return 0;}
virtual bx_bool restore_config() {return 0;} virtual bx_bool restore_config() {return 0;}
virtual bx_bool restore_logopts() {return 0;} virtual bx_bool restore_logopts() {return 0;}
virtual bx_bool restore_hardware() {return 0;} virtual bx_bool restore_hardware() {return 0;}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.327 2006-04-06 20:42:50 vruppert Exp $ // $Id: main.cc,v 1.328 2006-04-07 12:49:50 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -655,6 +655,12 @@ int bx_init_main (int argc, char *argv[])
int norcfile = 1; int norcfile = 1;
#if BX_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
load_rcfile = 0;
norcfile = 0;
}
#endif
if (load_rcfile) { if (load_rcfile) {
/* parse configuration file and command line arguments */ /* parse configuration file and command line arguments */
#ifdef WIN32 #ifdef WIN32
@ -1005,7 +1011,7 @@ int bx_init_hardware()
bx_pc_system.Reset(BX_RESET_HARDWARE); bx_pc_system.Reset(BX_RESET_HARDWARE);
#if BX_SAVE_RESTORE #if BX_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) { if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
SIM->restore_hardware(); // SIM->restore_hardware();
} }
#endif #endif
bx_gui->init_signal_handlers(); bx_gui->init_signal_handlers();