- prepared save/restore feature
- some siminterface types changed
This commit is contained in:
parent
e15980c348
commit
74c8c05d22
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.100 2006-04-05 16:05:11 vruppert Exp $
|
||||
// $Id: config.cc,v 1.101 2006-04-06 20:42:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -343,6 +343,20 @@ void bx_init_options()
|
||||
BX_RUN_START,
|
||||
BX_QUICK_START);
|
||||
|
||||
#if BX_SAVE_RESTORE
|
||||
new bx_param_bool_c(menu,
|
||||
"restore",
|
||||
"Restore Bochs session",
|
||||
"Restore Bochs session",
|
||||
0);
|
||||
new bx_param_string_c(menu,
|
||||
"restore_path",
|
||||
"Path to data for restore",
|
||||
"Path to data for restore",
|
||||
"",
|
||||
BX_PATHNAME_LEN);
|
||||
#endif
|
||||
|
||||
// subtree for special menus
|
||||
bx_list_c *special_menus = new bx_list_c(root_param, "menu", "");
|
||||
|
||||
|
@ -739,6 +739,9 @@ typedef
|
||||
|
||||
#define BX_SUPPORT_ICACHE 0
|
||||
|
||||
// save/restore (under construction)
|
||||
#define BX_SAVE_RESTORE 0
|
||||
|
||||
// if 1, don't do gpf on MSRs that we don't implement
|
||||
#define BX_IGNORE_BAD_MSR 0
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.cc,v 1.135 2006-04-05 16:05:11 vruppert Exp $
|
||||
// $Id: siminterface.cc,v 1.136 2006-04-06 20:42:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// See siminterface.h for description of the siminterface concept.
|
||||
@ -123,21 +123,28 @@ public:
|
||||
void *userdata);
|
||||
virtual int configuration_interface(const char* name, ci_command_t command);
|
||||
virtual int begin_simulation (int argc, char *argv[]);
|
||||
virtual void set_sim_thread_func (is_sim_thread_func_t func) {}
|
||||
virtual bool is_sim_thread ();
|
||||
bool wxsel;
|
||||
virtual bool is_wx_selected () { return wxsel; }
|
||||
virtual void set_sim_thread_func(is_sim_thread_func_t func) {}
|
||||
virtual bx_bool is_sim_thread();
|
||||
bx_bool wxsel;
|
||||
virtual bx_bool is_wx_selected() { return wxsel; }
|
||||
// provide interface to bx_gui->set_display_mode() method for config
|
||||
// interfaces to use.
|
||||
virtual void set_display_mode(disp_mode_t newmode) {
|
||||
if (bx_gui != NULL)
|
||||
bx_gui->set_display_mode(newmode);
|
||||
}
|
||||
virtual bool test_for_text_console();
|
||||
virtual bx_bool test_for_text_console();
|
||||
// user-defined option support
|
||||
virtual int find_user_option(const char *keyword);
|
||||
virtual bx_bool register_user_option(const char *keyword, user_option_handler_t handler);
|
||||
virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []);
|
||||
#if BX_SAVE_RESTORE
|
||||
// save/restore support
|
||||
virtual bx_bool save_state(const char *checkpoint_name);
|
||||
virtual bx_bool restore_config();
|
||||
virtual bx_bool restore_logopts();
|
||||
virtual bx_bool restore_hardware();
|
||||
#endif
|
||||
};
|
||||
|
||||
// recursive function to find parameters from the path
|
||||
@ -282,7 +289,7 @@ bx_real_sim_c::bx_real_sim_c()
|
||||
ci_callback = NULL;
|
||||
ci_callback_data = NULL;
|
||||
is_sim_thread_func = NULL;
|
||||
wxsel = false;
|
||||
wxsel = 0;
|
||||
|
||||
enabled = 1;
|
||||
init_done = 0;
|
||||
@ -591,7 +598,7 @@ void bx_real_sim_c::periodic()
|
||||
}
|
||||
|
||||
// create a disk image file called filename, size=512 bytes * sectors.
|
||||
// If overwrite is true and the file exists, returns -1 without changing it.
|
||||
// If overwrite is 0 and the file exists, returns -1 without changing it.
|
||||
// Otherwise, opens up the image and starts writing. Returns -2 if
|
||||
// the image could not be opened, or -3 if there are failures during
|
||||
// write, e.g. disk full.
|
||||
@ -748,9 +755,9 @@ int bx_real_sim_c::configuration_interface(const char *ignore, ci_command_t comm
|
||||
return -1;
|
||||
}
|
||||
if (!strcmp(name, "wx"))
|
||||
wxsel = true;
|
||||
wxsel = 1;
|
||||
else
|
||||
wxsel = false;
|
||||
wxsel = 0;
|
||||
// enter configuration mode, just while running the configuration interface
|
||||
set_display_mode(DISP_MODE_CONFIG);
|
||||
int retval = (*ci_callback)(ci_callback_data, command);
|
||||
@ -763,25 +770,25 @@ int bx_real_sim_c::begin_simulation(int argc, char *argv[])
|
||||
return bx_begin_simulation(argc, argv);
|
||||
}
|
||||
|
||||
bool bx_real_sim_c::is_sim_thread()
|
||||
bx_bool bx_real_sim_c::is_sim_thread()
|
||||
{
|
||||
if (is_sim_thread_func == NULL) return true;
|
||||
if (is_sim_thread_func == NULL) return 1;
|
||||
return (*is_sim_thread_func)();
|
||||
}
|
||||
|
||||
// check if the text console exists. On some platforms, if Bochs is
|
||||
// started from the "Start Menu" or by double clicking on it on a Mac,
|
||||
// there may be nothing attached to stdin/stdout/stderr. This function
|
||||
// tests if stdin/stdout/stderr are usable and returns false if not.
|
||||
bool bx_real_sim_c::test_for_text_console()
|
||||
// tests if stdin/stdout/stderr are usable and returns 0 if not.
|
||||
bx_bool bx_real_sim_c::test_for_text_console()
|
||||
{
|
||||
#if BX_WITH_CARBON
|
||||
// In a Carbon application, you have a text console if you run the app from
|
||||
// the command line, but if you start it from the finder you don't.
|
||||
if(!isatty(STDIN_FILENO)) return false;
|
||||
if(!isatty(STDIN_FILENO)) return 0;
|
||||
#endif
|
||||
// default: yes
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bx_real_sim_c::find_user_option(const char *keyword)
|
||||
@ -827,6 +834,36 @@ Bit32s bx_real_sim_c::parse_user_option(int idx, const char *context, int num_pa
|
||||
return (*user_option_handler[idx])(context, num_params, params);
|
||||
}
|
||||
|
||||
#if BX_SAVE_RESTORE
|
||||
bx_bool bx_real_sim_c::save_state(const char *checkpoint_name)
|
||||
{
|
||||
// TODO
|
||||
fprintf(stderr, "save_state (not implemented yet)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_real_sim_c::restore_config()
|
||||
{
|
||||
// TODO
|
||||
fprintf(stderr, "restore_config (not implemented yet)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_real_sim_c::restore_logopts()
|
||||
{
|
||||
// TODO
|
||||
fprintf(stderr, "restore_logopts (not implemented yet)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_real_sim_c::restore_hardware()
|
||||
{
|
||||
// TODO
|
||||
fprintf(stderr, "restore_hardware (not implemented yet)\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// define methods of bx_param_* and family
|
||||
@ -1253,12 +1290,12 @@ int bx_param_enum_c::find_by_name(const char *string)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool bx_param_enum_c::set_by_name(const char *string)
|
||||
bx_bool bx_param_enum_c::set_by_name(const char *string)
|
||||
{
|
||||
int n = find_by_name(string);
|
||||
if (n<0) return false;
|
||||
if (n<0) return 0;
|
||||
set(n + min);
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bx_param_string_c::bx_param_string_c(bx_param_c *parent,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.181 2006-04-05 16:05:11 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.182 2006-04-06 20:42:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Intro to siminterface by Bryce Denney:
|
||||
@ -222,6 +222,8 @@ typedef enum {
|
||||
#define BXPN_DEBUGGER_LOG_FILENAME "log.debugger_filename"
|
||||
#define BXPN_BOCHS_START "general.start_mode"
|
||||
#define BXPN_DEBUG_RUNNING "general.debug_running"
|
||||
#define BXPN_RESTORE_FLAG "general.restore"
|
||||
#define BXPN_RESTORE_PATH "general.restore_path"
|
||||
#define BXPN_MENU_DISK "menu.disk"
|
||||
#define BXPN_MENU_MEMORY "menu.memory"
|
||||
#define BXPN_MENU_RUNTIME "menu.runtime"
|
||||
@ -795,7 +797,7 @@ public:
|
||||
char *get_choice(int n) { return choices[n]; }
|
||||
char *get_selected() { return choices[val.number - min]; }
|
||||
int find_by_name(const char *string);
|
||||
bool set_by_name(const char *string);
|
||||
bx_bool set_by_name(const char *string);
|
||||
#if BX_USE_TEXTCONFIG
|
||||
virtual void text_print(FILE *fp);
|
||||
virtual int text_ask(FILE *fpin, FILE *fpout);
|
||||
@ -1162,21 +1164,28 @@ public:
|
||||
void *userdata) {}
|
||||
virtual int configuration_interface(const char* name, ci_command_t command) {return -1; }
|
||||
virtual int begin_simulation(int argc, char *argv[]) {return -1;}
|
||||
typedef bool (*is_sim_thread_func_t)();
|
||||
typedef bx_bool (*is_sim_thread_func_t)();
|
||||
is_sim_thread_func_t is_sim_thread_func;
|
||||
virtual void set_sim_thread_func(is_sim_thread_func_t func) {
|
||||
is_sim_thread_func = func;
|
||||
}
|
||||
virtual bool is_sim_thread() {return true;}
|
||||
virtual bool is_wx_selected() {return false;}
|
||||
virtual bx_bool is_sim_thread() {return 1;}
|
||||
virtual bx_bool is_wx_selected() {return 0;}
|
||||
// provide interface to bx_gui->set_display_mode() method for config
|
||||
// interfaces to use.
|
||||
virtual void set_display_mode(disp_mode_t newmode) {}
|
||||
virtual bool test_for_text_console() { return true; }
|
||||
virtual bx_bool test_for_text_console() {return 1;}
|
||||
// user-defined option support
|
||||
virtual int find_user_option(const char *keyword) {return -1;}
|
||||
virtual bx_bool register_user_option(const char *keyword, user_option_handler_t handler) {return 0;}
|
||||
virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []) {return -1;}
|
||||
#if BX_SAVE_RESTORE
|
||||
// save/restore support
|
||||
virtual bx_bool save_state(const char *checkpoint_name) {return 0;}
|
||||
virtual bx_bool restore_config() {return 0;}
|
||||
virtual bx_bool restore_logopts() {return 0;}
|
||||
virtual bx_bool restore_hardware() {return 0;}
|
||||
#endif
|
||||
};
|
||||
|
||||
BOCHSAPI extern bx_simulator_interface_c *SIM;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: textconfig.cc,v 1.48 2006-03-29 20:31:51 vruppert Exp $
|
||||
// $Id: textconfig.cc,v 1.49 2006-04-06 20:42:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is code for a text-mode configuration interface. Note that this file
|
||||
@ -230,8 +230,14 @@ static char *startup_menu_prompt =
|
||||
"2. Read options from...\n"
|
||||
"3. Edit options\n"
|
||||
"4. Save options to...\n"
|
||||
#if BX_SAVE_RESTORE
|
||||
"5. Restore Bochs session from...\n"
|
||||
"6. Begin simulation\n"
|
||||
"7. Quit now\n"
|
||||
#else
|
||||
"5. Begin simulation\n"
|
||||
"6. Quit now\n"
|
||||
#endif
|
||||
"\n"
|
||||
"Please choose one: [%d] ";
|
||||
|
||||
@ -273,11 +279,19 @@ static char *runtime_menu_prompt =
|
||||
"9. Log options for individual devices\n"
|
||||
"10. Instruction tracing: off (doesn't exist yet)\n"
|
||||
"11. Misc runtime options\n"
|
||||
#if BX_SAVE_RESTORE
|
||||
"12. Save Bochs state to...\n"
|
||||
"13. Continue simulation\n"
|
||||
"14. Quit now\n"
|
||||
"\n"
|
||||
"Please choose one: [13] ";
|
||||
#else
|
||||
"12. Continue simulation\n"
|
||||
"13. Quit now\n"
|
||||
"\n"
|
||||
"Please choose one: [12] ";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define NOT_IMPLEMENTED(choice) \
|
||||
fprintf (stderr, "ERROR: choice %d not implemented\n", choice);
|
||||
@ -356,140 +370,165 @@ void askparam(char *pname)
|
||||
param->text_ask(stdin, stderr);
|
||||
}
|
||||
|
||||
int bx_config_interface (int menu)
|
||||
int bx_config_interface(int menu)
|
||||
{
|
||||
Bit32u choice;
|
||||
while (1) {
|
||||
switch (menu)
|
||||
{
|
||||
case BX_CI_INIT:
|
||||
bx_config_interface_init ();
|
||||
return 0;
|
||||
case BX_CI_START_SIMULATION: {
|
||||
SIM->begin_simulation (bx_startup_flags.argc, bx_startup_flags.argv);
|
||||
// we don't expect it to return, but if it does, quit
|
||||
SIM->quit_sim(1);
|
||||
break;
|
||||
}
|
||||
case BX_CI_START_MENU:
|
||||
{
|
||||
Bit32u default_choice;
|
||||
switch (SIM->get_param_enum(BXPN_BOCHS_START)->get()) {
|
||||
case BX_LOAD_START:
|
||||
default_choice = 2; break;
|
||||
case BX_EDIT_START:
|
||||
default_choice = 3; break;
|
||||
default:
|
||||
default_choice = 5; break;
|
||||
}
|
||||
|
||||
if (ask_uint(startup_menu_prompt, 1, 6, default_choice, &choice, 10) < 0) return -1;
|
||||
switch (choice) {
|
||||
case 1:
|
||||
fprintf(stderr, "I reset all options back to their factory defaults.\n\n");
|
||||
SIM->reset_all_param();
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_EDIT_START);
|
||||
break;
|
||||
case 2:
|
||||
// Before reading a new configuration, reset every option to its
|
||||
// original state.
|
||||
SIM->reset_all_param();
|
||||
if (bx_read_rc (NULL) >= 0)
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_RUN_START);
|
||||
break;
|
||||
case 3:
|
||||
bx_config_interface(BX_CI_START_OPTS);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_RUN_START);
|
||||
break;
|
||||
case 4: bx_write_rc(NULL); break;
|
||||
case 5: bx_config_interface(BX_CI_START_SIMULATION); break;
|
||||
case 6: SIM->quit_sim(1); return -1;
|
||||
default: BAD_OPTION(menu, choice);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BX_CI_START_OPTS:
|
||||
{
|
||||
if (ask_uint(startup_options_prompt, 0, 14, 0, &choice, 10) < 0) return -1;
|
||||
switch (choice) {
|
||||
case 0: return 0;
|
||||
case 1: do_menu("log"); break;
|
||||
case 2: bx_log_options(0); break;
|
||||
case 3: bx_log_options(1); break;
|
||||
case 4: do_menu("cpu"); break;
|
||||
case 5: do_menu(BXPN_MENU_MEMORY); break;
|
||||
case 6: do_menu("clock_cmos"); break;
|
||||
case 7: do_menu("pci"); break;
|
||||
case 8: do_menu("display"); break;
|
||||
case 9: do_menu("keyboard_mouse"); break;
|
||||
case 10: do_menu(BXPN_MENU_DISK); break;
|
||||
case 11: do_menu("ports"); break;
|
||||
case 12: do_menu("network"); break;
|
||||
case 13: do_menu(BXPN_SB16); break;
|
||||
case 14: do_menu("misc"); break;
|
||||
default: BAD_OPTION(menu, choice);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BX_CI_RUNTIME:
|
||||
{
|
||||
bx_list_c *cdromop = NULL;
|
||||
char pname[80];
|
||||
#ifdef WIN32
|
||||
choice = RuntimeOptionsDialog();
|
||||
#else
|
||||
char prompt[1024];
|
||||
build_runtime_options_prompt(runtime_menu_prompt, prompt, 1024);
|
||||
if (ask_uint(prompt, 1, BX_CI_RT_QUIT, BX_CI_RT_CONT, &choice, 10) < 0) return -1;
|
||||
Bit32u choice;
|
||||
#if BX_SAVE_RESTORE
|
||||
char sr_path[CI_PATH_LENGTH];
|
||||
#endif
|
||||
switch (choice) {
|
||||
case BX_CI_RT_FLOPPYA:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYA);
|
||||
break;
|
||||
case BX_CI_RT_FLOPPYB:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYB);
|
||||
break;
|
||||
case BX_CI_RT_CDROM1:
|
||||
case BX_CI_RT_CDROM2:
|
||||
case BX_CI_RT_CDROM3:
|
||||
case BX_CI_RT_CDROM4:
|
||||
int device;
|
||||
if (SIM->get_cdrom_options(choice - BX_CI_RT_CDROM1, &cdromop, &device) && SIM->get_param_bool("present", cdromop)->get()) {
|
||||
// disable type selection
|
||||
SIM->get_param("type", cdromop)->set_enabled(0);
|
||||
SIM->get_param("model", cdromop)->set_enabled(0);
|
||||
SIM->get_param("biosdetect", cdromop)->set_enabled(0);
|
||||
cdromop->get_param_path(pname, 80);
|
||||
do_menu(pname);
|
||||
}
|
||||
break;
|
||||
case BX_CI_RT_IPS:
|
||||
// not implemented yet because I would have to mess with
|
||||
// resetting timers and pits and everything on the fly.
|
||||
// askparam(BXPN_IPS);
|
||||
break;
|
||||
case BX_CI_RT_LOGOPTS1: bx_log_options(0); break;
|
||||
case BX_CI_RT_LOGOPTS2: bx_log_options(1); break;
|
||||
case BX_CI_RT_INST_TR: NOT_IMPLEMENTED(choice); break;
|
||||
case BX_CI_RT_MISC: do_menu(BXPN_MENU_RUNTIME); break;
|
||||
case BX_CI_RT_CONT: fprintf(stderr, "Continuing simulation\n"); return 0;
|
||||
case BX_CI_RT_QUIT:
|
||||
fprintf(stderr, "You chose quit on the configuration interface.\n");
|
||||
bx_user_quit = 1;
|
||||
SIM->quit_sim(1);
|
||||
return -1;
|
||||
default: fprintf(stderr, "Menu choice %d not implemented.\n", choice);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Unknown config interface menu type.\n");
|
||||
assert (menu >=0 && menu < BX_CI_N_MENUS);
|
||||
while (1) {
|
||||
switch (menu) {
|
||||
case BX_CI_INIT:
|
||||
bx_config_interface_init();
|
||||
return 0;
|
||||
case BX_CI_START_SIMULATION:
|
||||
SIM->begin_simulation(bx_startup_flags.argc, bx_startup_flags.argv);
|
||||
// we don't expect it to return, but if it does, quit
|
||||
SIM->quit_sim(1);
|
||||
break;
|
||||
case BX_CI_START_MENU:
|
||||
{
|
||||
Bit32u default_choice;
|
||||
switch (SIM->get_param_enum(BXPN_BOCHS_START)->get()) {
|
||||
case BX_LOAD_START:
|
||||
default_choice = 2; break;
|
||||
case BX_EDIT_START:
|
||||
default_choice = 3; break;
|
||||
default:
|
||||
#if BX_SAVE_RESTORE
|
||||
default_choice = 6; break;
|
||||
#else
|
||||
default_choice = 5; break;
|
||||
#endif
|
||||
}
|
||||
#if BX_SAVE_RESTORE
|
||||
if (ask_uint(startup_menu_prompt, 1, 7, default_choice, &choice, 10) < 0) return -1;
|
||||
#else
|
||||
if (ask_uint(startup_menu_prompt, 1, 6, default_choice, &choice, 10) < 0) return -1;
|
||||
#endif
|
||||
switch (choice) {
|
||||
case 1:
|
||||
fprintf(stderr, "I reset all options back to their factory defaults.\n\n");
|
||||
SIM->reset_all_param();
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_EDIT_START);
|
||||
break;
|
||||
case 2:
|
||||
// Before reading a new configuration, reset every option to its
|
||||
// original state.
|
||||
SIM->reset_all_param();
|
||||
if (bx_read_rc(NULL) >= 0)
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_RUN_START);
|
||||
break;
|
||||
case 3:
|
||||
bx_config_interface(BX_CI_START_OPTS);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_RUN_START);
|
||||
break;
|
||||
case 4: bx_write_rc(NULL); break;
|
||||
#if BX_SAVE_RESTORE
|
||||
case 5:
|
||||
if (ask_string("\nWhat is the path to restore from?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
|
||||
SIM->get_param_bool(BXPN_RESTORE_FLAG)->set(1);
|
||||
SIM->get_param_string(BXPN_RESTORE_PATH)->set(sr_path);
|
||||
bx_config_interface(BX_CI_START_SIMULATION);
|
||||
}
|
||||
break;
|
||||
case 6: bx_config_interface(BX_CI_START_SIMULATION); break;
|
||||
case 7: SIM->quit_sim(1); return -1;
|
||||
#else
|
||||
case 5: bx_config_interface(BX_CI_START_SIMULATION); break;
|
||||
case 6: SIM->quit_sim(1); return -1;
|
||||
#endif
|
||||
default: BAD_OPTION(menu, choice);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BX_CI_START_OPTS:
|
||||
if (ask_uint(startup_options_prompt, 0, 14, 0, &choice, 10) < 0) return -1;
|
||||
switch (choice) {
|
||||
case 0: return 0;
|
||||
case 1: do_menu("log"); break;
|
||||
case 2: bx_log_options(0); break;
|
||||
case 3: bx_log_options(1); break;
|
||||
case 4: do_menu("cpu"); break;
|
||||
case 5: do_menu(BXPN_MENU_MEMORY); break;
|
||||
case 6: do_menu("clock_cmos"); break;
|
||||
case 7: do_menu("pci"); break;
|
||||
case 8: do_menu("display"); break;
|
||||
case 9: do_menu("keyboard_mouse"); break;
|
||||
case 10: do_menu(BXPN_MENU_DISK); break;
|
||||
case 11: do_menu("ports"); break;
|
||||
case 12: do_menu("network"); break;
|
||||
case 13: do_menu(BXPN_SB16); break;
|
||||
case 14: do_menu("misc"); break;
|
||||
default: BAD_OPTION(menu, choice);
|
||||
}
|
||||
break;
|
||||
case BX_CI_RUNTIME:
|
||||
{
|
||||
bx_list_c *cdromop = NULL;
|
||||
char pname[80];
|
||||
#ifdef WIN32
|
||||
choice = RuntimeOptionsDialog();
|
||||
#else
|
||||
char prompt[1024];
|
||||
build_runtime_options_prompt(runtime_menu_prompt, prompt, 1024);
|
||||
if (ask_uint(prompt, 1, BX_CI_RT_QUIT, BX_CI_RT_CONT, &choice, 10) < 0) return -1;
|
||||
#endif
|
||||
switch (choice) {
|
||||
case BX_CI_RT_FLOPPYA:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYA);
|
||||
break;
|
||||
case BX_CI_RT_FLOPPYB:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYB);
|
||||
break;
|
||||
case BX_CI_RT_CDROM1:
|
||||
case BX_CI_RT_CDROM2:
|
||||
case BX_CI_RT_CDROM3:
|
||||
case BX_CI_RT_CDROM4:
|
||||
int device;
|
||||
if (SIM->get_cdrom_options(choice - BX_CI_RT_CDROM1, &cdromop, &device) && SIM->get_param_bool("present", cdromop)->get()) {
|
||||
// disable type selection
|
||||
SIM->get_param("type", cdromop)->set_enabled(0);
|
||||
SIM->get_param("model", cdromop)->set_enabled(0);
|
||||
SIM->get_param("biosdetect", cdromop)->set_enabled(0);
|
||||
cdromop->get_param_path(pname, 80);
|
||||
do_menu(pname);
|
||||
}
|
||||
break;
|
||||
case BX_CI_RT_IPS:
|
||||
// not implemented yet because I would have to mess with
|
||||
// resetting timers and pits and everything on the fly.
|
||||
// askparam(BXPN_IPS);
|
||||
break;
|
||||
case BX_CI_RT_LOGOPTS1: bx_log_options(0); break;
|
||||
case BX_CI_RT_LOGOPTS2: bx_log_options(1); break;
|
||||
case BX_CI_RT_INST_TR: NOT_IMPLEMENTED(choice); break;
|
||||
case BX_CI_RT_MISC: do_menu(BXPN_MENU_RUNTIME); break;
|
||||
case BX_CI_RT_CONT: fprintf(stderr, "Continuing simulation\n"); return 0;
|
||||
case BX_CI_RT_QUIT:
|
||||
fprintf(stderr, "You chose quit on the configuration interface.\n");
|
||||
bx_user_quit = 1;
|
||||
SIM->quit_sim(1);
|
||||
return -1;
|
||||
#if BX_SAVE_RESTORE
|
||||
case BX_CI_RT_SAVE:
|
||||
if (ask_string("\nWhat is the path to save the Bochs state?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
|
||||
SIM->save_state(sr_path);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default: fprintf(stderr, "Menu choice %d not implemented.\n", choice);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Unknown config interface menu type.\n");
|
||||
assert (menu >=0 && menu < BX_CI_N_MENUS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void bx_print_log_action_table ()
|
||||
static void bx_print_log_action_table()
|
||||
{
|
||||
// just try to print all the prefixes first.
|
||||
fprintf (stderr, "Current log settings:\n");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: textconfig.h,v 1.3 2004-06-05 08:40:24 vruppert Exp $
|
||||
// $Id: textconfig.h,v 1.4 2006-04-06 20:42:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@ -33,6 +33,9 @@ enum {
|
||||
BX_CI_RT_LOGOPTS2,
|
||||
BX_CI_RT_INST_TR,
|
||||
BX_CI_RT_MISC,
|
||||
#if BX_SAVE_RESTORE
|
||||
BX_CI_RT_SAVE,
|
||||
#endif
|
||||
BX_CI_RT_CONT,
|
||||
BX_CI_RT_QUIT
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.326 2006-03-14 18:11:22 sshwarts Exp $
|
||||
// $Id: main.cc,v 1.327 2006-04-06 20:42:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -459,13 +459,16 @@ int main (int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
void print_usage ()
|
||||
void print_usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: bochs [flags] [bochsrc options]\n\n"
|
||||
" -n no configuration file\n"
|
||||
" -f configfile specify configuration file\n"
|
||||
" -q quick start (skip configuration interface)\n"
|
||||
#if BX_SAVE_RESTORE
|
||||
" -r restore Bochs session\n"
|
||||
#endif
|
||||
" --help display this help and exit\n\n"
|
||||
"For information on Bochs configuration file arguments, see the\n"
|
||||
#if (!defined(WIN32)) && !BX_WITH_MACOS
|
||||
@ -524,6 +527,16 @@ int bx_init_main (int argc, char *argv[])
|
||||
if (++arg >= argc) BX_PANIC(("-qf must be followed by a filename"));
|
||||
else bochsrc_filename = argv[arg];
|
||||
}
|
||||
#if BX_SAVE_RESTORE
|
||||
else if (!strcmp ("-r", argv[arg])) {
|
||||
if (++arg >= argc) BX_PANIC(("-r must be followed by a path"));
|
||||
else {
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
|
||||
SIM->get_param_bool(BXPN_RESTORE_FLAG)->set(1);
|
||||
SIM->get_param_string(BXPN_RESTORE_PATH)->set(argv[arg]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if BX_WITH_CARBON
|
||||
else if (!strncmp ("-psn", argv[arg], 4)) {
|
||||
// "-psn" is passed if we are launched by double-clicking
|
||||
@ -776,6 +789,11 @@ bx_bool load_and_init_display_lib ()
|
||||
|
||||
int bx_begin_simulation (int argc, char *argv[])
|
||||
{
|
||||
#if BX_SAVE_RESTORE
|
||||
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
|
||||
SIM->restore_config();
|
||||
}
|
||||
#endif
|
||||
// deal with gui selection
|
||||
if (!load_and_init_display_lib ()) {
|
||||
BX_PANIC (("no gui module was loaded"));
|
||||
@ -872,6 +890,11 @@ int bx_init_hardware()
|
||||
io->set_log_action (level, action);
|
||||
}
|
||||
}
|
||||
#if BX_SAVE_RESTORE
|
||||
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
|
||||
SIM->restore_logopts();
|
||||
}
|
||||
#endif
|
||||
|
||||
bx_pc_system.initialize(SIM->get_param_num(BXPN_IPS)->get());
|
||||
|
||||
@ -980,6 +1003,11 @@ int bx_init_hardware()
|
||||
DEV_init_devices();
|
||||
// will enable A20 line and reset CPU and devices
|
||||
bx_pc_system.Reset(BX_RESET_HARDWARE);
|
||||
#if BX_SAVE_RESTORE
|
||||
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
|
||||
SIM->restore_hardware();
|
||||
}
|
||||
#endif
|
||||
bx_gui->init_signal_handlers();
|
||||
bx_pc_system.start_timers();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user