mirror of https://github.com/bochs-emu/Bochs
- remaining config options and special menus added to parameter tree
- parameter tree structure updated (TODO: should be moved to development.dbk) - code cleanup: bx_options stuff and obsolete parameter access methods removed - TODO: rewrite of shadow parameter stuff (for subtree "save_restore")
This commit is contained in:
parent
fc0894bbe1
commit
dd7e08de99
|
@ -1,4 +1,4 @@
|
|||
$Id: PARAM_TREE.txt,v 1.10 2006-03-02 20:13:13 vruppert Exp $
|
||||
$Id: PARAM_TREE.txt,v 1.11 2006-03-05 10:24:27 vruppert Exp $
|
||||
|
||||
I'm trying to organize the parameters into a tree structure instead of
|
||||
a huge flat list. Once the parameter code is improved, I hope to use
|
||||
|
@ -263,14 +263,14 @@ log
|
|||
|
||||
general
|
||||
start_mode BXP_BOCHS_START,
|
||||
debug_running BXP_DEBUG_RUNNING,
|
||||
|
||||
debugger
|
||||
running BXP_DEBUG_RUNNING,
|
||||
|
||||
config_menus
|
||||
main BXP_MENU_MAIN,
|
||||
menu
|
||||
disk BXP_MENU_DISK,
|
||||
sound BXP_MENU_SOUND,
|
||||
memory BXP_MENU_MEMORY,
|
||||
runtime BXP_MENU_RUNTIME,
|
||||
|
||||
(updated Mar 2, 2006 by vruppert)
|
||||
save_restore
|
||||
(special subtree for save/restore Bochs state)
|
||||
|
||||
(updated Mar 5, 2006 by vruppert)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: bochs.h,v 1.186 2006-03-04 12:43:46 vruppert Exp $
|
||||
// $Id: bochs.h,v 1.187 2006-03-05 10:24:27 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -464,12 +464,6 @@ extern bx_bool bx_gui_sighandler;
|
|||
|
||||
#define BX_PATHNAME_LEN 512
|
||||
|
||||
typedef struct {
|
||||
bx_param_string_c *Ofilename;
|
||||
bx_param_string_c *Oprefix;
|
||||
bx_param_string_c *Odebugger_filename;
|
||||
} bx_log_options;
|
||||
|
||||
#define BX_KBD_XT_TYPE 0
|
||||
#define BX_KBD_AT_TYPE 1
|
||||
#define BX_KBD_MF_TYPE 2
|
||||
|
@ -481,12 +475,6 @@ typedef struct {
|
|||
#define BX_N_USB_HUBS 1
|
||||
#define BX_N_PCI_SLOTS 5
|
||||
|
||||
typedef struct BOCHSAPI {
|
||||
bx_log_options log;
|
||||
} bx_options_t;
|
||||
|
||||
BOCHSAPI extern bx_options_t bx_options;
|
||||
|
||||
#if BX_SUPPORT_SMP
|
||||
#define BX_SMP_PROCESSORS (bx_cpu_count)
|
||||
#else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dbg_main.cc,v 1.59 2006-02-23 22:48:57 vruppert Exp $
|
||||
// $Id: dbg_main.cc,v 1.60 2006-03-05 10:24:28 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
|
@ -198,16 +198,16 @@ int bx_dbg_main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
// Open debugger log file if needed
|
||||
if ((strlen(bx_options.log.Odebugger_filename->getptr()) > 0)
|
||||
&& (strcmp(bx_options.log.Odebugger_filename->getptr(), "-") != 0)) {
|
||||
debugger_log = fopen (bx_options.log.Odebugger_filename->getptr(), "w");
|
||||
if ((strlen(SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()) > 0)
|
||||
&& (strcmp(SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr(), "-") != 0)) {
|
||||
debugger_log = fopen (SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr(), "w");
|
||||
if (!debugger_log) {
|
||||
BX_PANIC(("Can not open debugger log file '%s'",
|
||||
bx_options.log.Odebugger_filename->getptr()));
|
||||
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()));
|
||||
}
|
||||
else {
|
||||
BX_INFO(("Using debugger log file %s",
|
||||
bx_options.log.Odebugger_filename->getptr()));
|
||||
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,9 @@ int bx_dbg_main(int argc, char *argv[])
|
|||
// create a boolean parameter that will tell if the simulation is
|
||||
// running (continue command) or waiting for user response. This affects
|
||||
// some parts of the GUI.
|
||||
sim_running = new bx_param_bool_c (BXP_DEBUG_RUNNING,
|
||||
bx_list_c *base = SIM->get_param("general");
|
||||
sim_running = new bx_param_bool_c(base,
|
||||
"debug_running",
|
||||
"Simulation is running", "", 0);
|
||||
|
||||
// setup Ctrl-C handler
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.93 2006-03-04 12:43:46 vruppert Exp $
|
||||
// $Id: config.cc,v 1.94 2006-03-05 10:24:27 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -46,8 +46,6 @@ int bochsrc_include_count = 0;
|
|||
|
||||
extern bx_debug_t bx_dbg;
|
||||
|
||||
bx_options_t bx_options; // initialized in bx_init_options()
|
||||
|
||||
static char *get_builtin_variable(char *varname);
|
||||
static Bit32s parse_line_unformatted(char *context, char *line);
|
||||
static Bit32s parse_line_formatted(char *context, int num_params, char *params[]);
|
||||
|
@ -331,18 +329,23 @@ void bx_init_options()
|
|||
bx_param_filename_c *path;
|
||||
char name[BX_PATHNAME_LEN], descr[512], group[16], label[512];
|
||||
|
||||
memset(&bx_options, 0, sizeof(bx_options));
|
||||
|
||||
bx_param_c *root_param = SIM->get_param(".");
|
||||
|
||||
// general options subtree
|
||||
menu = new bx_list_c(root_param, "general", "");
|
||||
|
||||
// quick start option, set by command line arg
|
||||
new bx_param_enum_c(BXP_BOCHS_START,
|
||||
new bx_param_enum_c(menu,
|
||||
"start_mode",
|
||||
"Bochs start types",
|
||||
"Bochs start types",
|
||||
bochs_start_names,
|
||||
BX_RUN_START,
|
||||
BX_QUICK_START);
|
||||
|
||||
// subtree for special menus
|
||||
bx_list_c *special_menus = new bx_list_c(root_param, "menu", "");
|
||||
|
||||
#if BX_SUPPORT_SMP
|
||||
#define BX_CPU_PROCESSORS_LIMIT 8
|
||||
#define BX_CPU_CORES_LIMIT 4
|
||||
|
@ -504,7 +507,7 @@ void bx_init_options()
|
|||
SIM->get_param("memory.optram"),
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c(BXP_MENU_MEMORY, "Bochs Memory Options", "", memory_init_list);
|
||||
menu = new bx_list_c(special_menus, "memory", "Bochs Memory Options", memory_init_list);
|
||||
menu->get_options()->set(bx_list_c::SHOW_PARENT);
|
||||
|
||||
// clock & cmos subtree
|
||||
|
@ -607,7 +610,7 @@ void bx_init_options()
|
|||
#endif
|
||||
// add final NULL at the end, and build the menu
|
||||
*pci_deps_ptr = NULL;
|
||||
i440fx_support->set_dependent_list(new bx_list_c(BXP_NULL, "", "", pci_deps_list));
|
||||
i440fx_support->set_dependent_list(new bx_list_c(NULL, "", "", pci_deps_list));
|
||||
pci->get_options()->set(bx_list_c::SHOW_PARENT);
|
||||
slot->get_options()->set(bx_list_c::SHOW_PARENT);
|
||||
pcidev->get_options()->set(bx_list_c::SHOW_PARENT | bx_list_c::USE_BOX_TITLE);
|
||||
|
@ -1198,7 +1201,7 @@ void bx_init_options()
|
|||
SIM->get_param("boot_params"),
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c(BXP_MENU_DISK, "Bochs Disk Options", "", disk_menu_init_list);
|
||||
menu = new bx_list_c(special_menus, "disk", "Bochs Disk Options", disk_menu_init_list);
|
||||
menu->get_options()->set(bx_list_c::SHOW_PARENT);
|
||||
|
||||
// ports subtree
|
||||
|
@ -1567,24 +1570,31 @@ void bx_init_options()
|
|||
0);
|
||||
enabled->set_dependent_list(menu->clone());
|
||||
|
||||
// log options subtree
|
||||
menu = new bx_list_c(root_param, "log", "Logfile Options");
|
||||
|
||||
// log options
|
||||
bx_options.log.Ofilename = new bx_param_filename_c(BXP_LOG_FILENAME,
|
||||
path = new bx_param_filename_c(menu,
|
||||
"filename",
|
||||
"Log filename",
|
||||
"Pathname of bochs log file",
|
||||
"-", BX_PATHNAME_LEN);
|
||||
bx_options.log.Ofilename->set_ask_format("Enter log filename: [%s] ");
|
||||
path->set_ask_format("Enter log filename: [%s] ");
|
||||
|
||||
bx_options.log.Oprefix = new bx_param_string_c(BXP_LOG_PREFIX,
|
||||
bx_param_string_c *prefix = new bx_param_string_c(menu,
|
||||
"prefix",
|
||||
"Log output prefix",
|
||||
"Prefix prepended to log output",
|
||||
"%t%e%d", BX_PATHNAME_LEN);
|
||||
bx_options.log.Oprefix->set_ask_format("Enter log prefix: [%s] ");
|
||||
prefix->set_ask_format("Enter log prefix: [%s] ");
|
||||
|
||||
bx_options.log.Odebugger_filename = new bx_param_filename_c(BXP_DEBUGGER_LOG_FILENAME,
|
||||
path = new bx_param_filename_c(menu,
|
||||
"debugger_filename",
|
||||
"Debugger Log filename",
|
||||
"Pathname of debugger log file",
|
||||
"-", BX_PATHNAME_LEN);
|
||||
bx_options.log.Odebugger_filename->set_ask_format("Enter debugger log filename: [%s] ");
|
||||
path->set_ask_format("Enter debugger log filename: [%s] ");
|
||||
path->set_enabled(BX_DEBUGGER);
|
||||
|
||||
// runtime options
|
||||
bx_param_c *runtime_init_list[] = {
|
||||
|
@ -1600,7 +1610,7 @@ void bx_init_options()
|
|||
SIM->get_param_string(BXPN_USB1_OPTION2),
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c(BXP_MENU_RUNTIME, "runtime", "Misc runtime options", runtime_init_list);
|
||||
menu = new bx_list_c(special_menus, "runtime", "Misc runtime options", runtime_init_list);
|
||||
menu->get_options()->set(bx_list_c::SHOW_PARENT | bx_list_c::SHOW_GROUP_NAME);
|
||||
|
||||
// param-tree test output
|
||||
|
@ -1650,9 +1660,7 @@ void bx_reset_options()
|
|||
SIM->get_param("misc")->reset();
|
||||
|
||||
// logfile
|
||||
bx_options.log.Ofilename->reset();
|
||||
bx_options.log.Oprefix->reset();
|
||||
bx_options.log.Odebugger_filename->reset();
|
||||
SIM->get_param("log")->reset();
|
||||
}
|
||||
|
||||
int bx_read_configuration (char *rcfile)
|
||||
|
@ -2324,17 +2332,17 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
|
|||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: log directive has wrong # args.", context));
|
||||
}
|
||||
bx_options.log.Ofilename->set (params[1]);
|
||||
SIM->get_param_string(BXPN_LOG_FILENAME)->set(params[1]);
|
||||
} else if (!strcmp(params[0], "logprefix")) {
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: logprefix directive has wrong # args.", context));
|
||||
}
|
||||
bx_options.log.Oprefix->set (params[1]);
|
||||
SIM->get_param_string(BXPN_LOG_PREFIX)->set(params[1]);
|
||||
} else if (!strcmp(params[0], "debugger_log")) {
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: debugger_log directive has wrong # args.", context));
|
||||
}
|
||||
bx_options.log.Odebugger_filename->set (params[1]);
|
||||
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->set(params[1]);
|
||||
} else if (!strcmp(params[0], "panic")) {
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: panic directive malformed.", context));
|
||||
|
@ -3272,20 +3280,20 @@ int bx_write_clock_cmos_options(FILE *fp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bx_write_log_options (FILE *fp, bx_log_options *opt)
|
||||
int bx_write_log_options(FILE *fp, bx_list_c *base)
|
||||
{
|
||||
fprintf (fp, "log: %s\n", opt->Ofilename->getptr ());
|
||||
fprintf (fp, "logprefix: %s\n", opt->Oprefix->getptr ());
|
||||
fprintf (fp, "debugger_log: %s\n", opt->Odebugger_filename->getptr ());
|
||||
fprintf (fp, "panic: action=%s\n",
|
||||
fprintf(fp, "log: %s\n", SIM->get_param_string("filename", base)->getptr());
|
||||
fprintf(fp, "logprefix: %s\n", SIM->get_param_string("prefix", base)->getptr());
|
||||
fprintf(fp, "debugger_log: %s\n", SIM->get_param_string("debugger_filename", base)->getptr());
|
||||
fprintf(fp, "panic: action=%s\n",
|
||||
io->getaction(logfunctions::get_default_action (LOGLEV_PANIC)));
|
||||
fprintf (fp, "error: action=%s\n",
|
||||
fprintf(fp, "error: action=%s\n",
|
||||
io->getaction(logfunctions::get_default_action (LOGLEV_ERROR)));
|
||||
fprintf (fp, "info: action=%s\n",
|
||||
fprintf(fp, "info: action=%s\n",
|
||||
io->getaction(logfunctions::get_default_action (LOGLEV_INFO)));
|
||||
fprintf (fp, "debug: action=%s\n",
|
||||
fprintf(fp, "debug: action=%s\n",
|
||||
io->getaction(logfunctions::get_default_action (LOGLEV_DEBUG)));
|
||||
fprintf (fp, "pass: action=%s\n",
|
||||
fprintf(fp, "pass: action=%s\n",
|
||||
io->getaction(logfunctions::get_default_action (LOGLEV_PASS)));
|
||||
return 0;
|
||||
}
|
||||
|
@ -3431,7 +3439,7 @@ int bx_write_configuration(char *rc, int overwrite)
|
|||
bx_write_pnic_options(fp, (bx_list_c*) SIM->get_param(BXPN_PNIC));
|
||||
bx_write_sb16_options(fp, (bx_list_c*) SIM->get_param(BXPN_SB16));
|
||||
bx_write_loader_options(fp);
|
||||
bx_write_log_options(fp, &bx_options.log);
|
||||
bx_write_log_options(fp, (bx_list_c*) SIM->get_param("log"));
|
||||
bx_write_keyboard_options(fp);
|
||||
fprintf(fp, "mouse: enabled=%d, type=%s\n",
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.cc,v 1.124 2006-02-28 16:19:28 vruppert Exp $
|
||||
// $Id: siminterface.cc,v 1.125 2006-03-05 10:24:28 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// See siminterface.h for description of the siminterface concept.
|
||||
|
@ -52,13 +52,9 @@ public:
|
|||
*max = BXP_THIS_IS_THE_LAST-1;
|
||||
}
|
||||
virtual int register_param (bx_id id, bx_param_c *it);
|
||||
virtual void reset_all_param ();
|
||||
// deprecated param methods
|
||||
virtual bx_param_c *get_param (bx_id id);
|
||||
virtual bx_param_num_c *get_param_num (bx_id id);
|
||||
virtual bx_param_string_c *get_param_string (bx_id id);
|
||||
virtual bx_param_bool_c *get_param_bool (bx_id id);
|
||||
virtual bx_param_enum_c *get_param_enum (bx_id id);
|
||||
virtual void reset_all_param();
|
||||
// deprecated param method
|
||||
virtual bx_param_c *get_param(bx_id id);
|
||||
// new param methods
|
||||
virtual bx_param_c *get_param(const char *pname, bx_param_c *base=NULL);
|
||||
virtual bx_param_num_c *get_param_num(const char *pname, bx_param_c *base=NULL);
|
||||
|
@ -66,35 +62,35 @@ public:
|
|||
virtual bx_param_bool_c *get_param_bool(const char *pname, bx_param_c *base=NULL);
|
||||
virtual bx_param_enum_c *get_param_enum(const char *pname, bx_param_c *base=NULL);
|
||||
virtual unsigned gen_param_id();
|
||||
virtual int get_n_log_modules ();
|
||||
virtual char *get_prefix (int mod);
|
||||
virtual int get_log_action (int mod, int level);
|
||||
virtual void set_log_action (int mod, int level, int action);
|
||||
virtual char *get_action_name (int action);
|
||||
virtual int get_default_log_action (int level) {
|
||||
return logfunctions::get_default_action (level);
|
||||
virtual int get_n_log_modules();
|
||||
virtual char *get_prefix(int mod);
|
||||
virtual int get_log_action(int mod, int level);
|
||||
virtual void set_log_action(int mod, int level, int action);
|
||||
virtual char *get_action_name(int action);
|
||||
virtual int get_default_log_action(int level) {
|
||||
return logfunctions::get_default_action(level);
|
||||
}
|
||||
virtual void set_default_log_action (int level, int action) {
|
||||
logfunctions::set_default_action (level, action);
|
||||
virtual void set_default_log_action(int level, int action) {
|
||||
logfunctions::set_default_action(level, action);
|
||||
}
|
||||
virtual const char *get_log_level_name (int level);
|
||||
virtual int get_max_log_level ();
|
||||
virtual void quit_sim (int code);
|
||||
virtual int get_exit_code () { return exit_code; }
|
||||
virtual int get_default_rc (char *path, int len);
|
||||
virtual int read_rc (char *path);
|
||||
virtual int write_rc (char *path, int overwrite);
|
||||
virtual int get_log_file (char *path, int len);
|
||||
virtual int set_log_file (char *path);
|
||||
virtual int get_log_prefix (char *prefix, int len);
|
||||
virtual int set_log_prefix (char *prefix);
|
||||
virtual int get_debugger_log_file (char *path, int len);
|
||||
virtual int set_debugger_log_file (char *path);
|
||||
virtual const char *get_log_level_name(int level);
|
||||
virtual int get_max_log_level();
|
||||
virtual void quit_sim(int code);
|
||||
virtual int get_exit_code() { return exit_code; }
|
||||
virtual int get_default_rc(char *path, int len);
|
||||
virtual int read_rc(char *path);
|
||||
virtual int write_rc(char *path, int overwrite);
|
||||
virtual int get_log_file(char *path, int len);
|
||||
virtual int set_log_file(char *path);
|
||||
virtual int get_log_prefix(char *prefix, int len);
|
||||
virtual int set_log_prefix(char *prefix);
|
||||
virtual int get_debugger_log_file(char *path, int len);
|
||||
virtual int set_debugger_log_file(char *path);
|
||||
virtual int get_cdrom_options(int drive, bx_list_c **out, int *device = NULL);
|
||||
virtual void set_notify_callback (bxevent_handler func, void *arg);
|
||||
virtual void get_notify_callback (bxevent_handler *func, void **arg);
|
||||
virtual BxEvent* sim_to_ci_event (BxEvent *event);
|
||||
virtual int log_msg (const char *prefix, int level, const char *msg);
|
||||
virtual void set_notify_callback(bxevent_handler func, void *arg);
|
||||
virtual void get_notify_callback(bxevent_handler *func, void **arg);
|
||||
virtual BxEvent* sim_to_ci_event(BxEvent *event);
|
||||
virtual int log_msg(const char *prefix, int level, const char *msg);
|
||||
virtual int ask_param(bx_param_c *param);
|
||||
virtual int ask_param(const char *pname);
|
||||
// ask the user for a pathname
|
||||
|
@ -145,19 +141,19 @@ public:
|
|||
};
|
||||
|
||||
bx_param_c *
|
||||
bx_real_sim_c::get_param (bx_id id)
|
||||
bx_real_sim_c::get_param(bx_id id)
|
||||
{
|
||||
BX_ASSERT (id >= BXP_NULL && id < BXP_THIS_IS_THE_LAST);
|
||||
BX_ASSERT(id >= BXP_NULL && id < BXP_THIS_IS_THE_LAST);
|
||||
int index = (int)id - BXP_NULL;
|
||||
bx_param_c *retval = param_registry[index];
|
||||
if (!retval)
|
||||
BX_INFO (("get_param can't find id %u", id));
|
||||
BX_INFO(("get_param can't find id %u", id));
|
||||
return retval;
|
||||
}
|
||||
|
||||
// recursive function to find parameters from the path
|
||||
static
|
||||
bx_param_c *find_param (const char *full_pname, const char *rest_of_pname, bx_param_c *base)
|
||||
bx_param_c *find_param(const char *full_pname, const char *rest_of_pname, bx_param_c *base)
|
||||
{
|
||||
const char *from = rest_of_pname;
|
||||
char component[BX_PATHNAME_LEN];
|
||||
|
@ -181,7 +177,7 @@ bx_param_c *find_param (const char *full_pname, const char *rest_of_pname, bx_pa
|
|||
|
||||
// find the component in the list.
|
||||
bx_list_c *list = (bx_list_c *)base;
|
||||
bx_param_c *child = list->get_by_name (component);
|
||||
bx_param_c *child = list->get_by_name(component);
|
||||
// if child not found, there is nothing else that can be done. return NULL.
|
||||
if (child == NULL) return NULL;
|
||||
if (from[0] == 0) {
|
||||
|
@ -191,7 +187,7 @@ bx_param_c *find_param (const char *full_pname, const char *rest_of_pname, bx_pa
|
|||
// continue parsing the path
|
||||
BX_ASSERT(from[0] == '.');
|
||||
from++; // skip over the separator
|
||||
return find_param (full_pname, from, child);
|
||||
return find_param(full_pname, from, child);
|
||||
}
|
||||
|
||||
bx_param_c *
|
||||
|
@ -205,20 +201,6 @@ bx_real_sim_c::get_param(const char *pname, bx_param_c *base)
|
|||
return find_param(pname, pname, base);
|
||||
}
|
||||
|
||||
bx_param_num_c *
|
||||
bx_real_sim_c::get_param_num (bx_id id) {
|
||||
bx_param_c *generic = get_param(id);
|
||||
if (generic==NULL) {
|
||||
BX_PANIC (("get_param_num(%u) could not find a parameter", id));
|
||||
return NULL;
|
||||
}
|
||||
int type = generic->get_type ();
|
||||
if (type == BXT_PARAM_NUM || type == BXT_PARAM_BOOL || type == BXT_PARAM_ENUM)
|
||||
return (bx_param_num_c *)generic;
|
||||
BX_PANIC (("get_param_num %u could not find an integer parameter with that id", id));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_num_c *
|
||||
bx_real_sim_c::get_param_num (const char *pname, bx_param_c *base) {
|
||||
bx_param_c *generic = get_param(pname, base);
|
||||
|
@ -233,19 +215,6 @@ bx_real_sim_c::get_param_num (const char *pname, bx_param_c *base) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_string_c *
|
||||
bx_real_sim_c::get_param_string (bx_id id) {
|
||||
bx_param_c *generic = get_param(id);
|
||||
if (generic==NULL) {
|
||||
BX_PANIC (("get_param_string(%u) could not find a parameter", id));
|
||||
return NULL;
|
||||
}
|
||||
if (generic->get_type () == BXT_PARAM_STRING)
|
||||
return (bx_param_string_c *)generic;
|
||||
BX_PANIC (("get_param_string %u could not find an integer parameter with that id", id));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_string_c *
|
||||
bx_real_sim_c::get_param_string(const char *pname, bx_param_c *base) {
|
||||
bx_param_c *generic = get_param(pname, base);
|
||||
|
@ -259,19 +228,6 @@ bx_real_sim_c::get_param_string(const char *pname, bx_param_c *base) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_bool_c *
|
||||
bx_real_sim_c::get_param_bool (bx_id id) {
|
||||
bx_param_c *generic = get_param(id);
|
||||
if (generic==NULL) {
|
||||
BX_PANIC (("get_param_bool(%u) could not find a parameter", id));
|
||||
return NULL;
|
||||
}
|
||||
if (generic->get_type () == BXT_PARAM_BOOL)
|
||||
return (bx_param_bool_c *)generic;
|
||||
BX_PANIC (("get_param_bool %u could not find a bool parameter with that id", id));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_bool_c *
|
||||
bx_real_sim_c::get_param_bool(const char *pname, bx_param_c *base) {
|
||||
bx_param_c *generic = get_param(pname, base);
|
||||
|
@ -285,19 +241,6 @@ bx_real_sim_c::get_param_bool(const char *pname, bx_param_c *base) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_enum_c *
|
||||
bx_real_sim_c::get_param_enum (bx_id id) {
|
||||
bx_param_c *generic = get_param(id);
|
||||
if (generic==NULL) {
|
||||
BX_PANIC (("get_param_enum(%u) could not find a parameter", id));
|
||||
return NULL;
|
||||
}
|
||||
if (generic->get_type () == BXT_PARAM_ENUM)
|
||||
return (bx_param_enum_c *)generic;
|
||||
BX_PANIC (("get_param_enum %u could not find a enum parameter with that id", id));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bx_param_enum_c *
|
||||
bx_real_sim_c::get_param_enum(const char *pname, bx_param_c *base) {
|
||||
bx_param_c *generic = get_param(pname, base);
|
||||
|
@ -475,7 +418,7 @@ bx_real_sim_c::get_default_rc (char *path, int len)
|
|||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::read_rc (char *rc)
|
||||
bx_real_sim_c::read_rc(char *rc)
|
||||
{
|
||||
return bx_read_configuration (rc);
|
||||
}
|
||||
|
@ -485,50 +428,50 @@ bx_real_sim_c::read_rc (char *rc)
|
|||
// -1: failed
|
||||
// -2: already exists, and overwrite was off
|
||||
int
|
||||
bx_real_sim_c::write_rc (char *rc, int overwrite)
|
||||
bx_real_sim_c::write_rc(char *rc, int overwrite)
|
||||
{
|
||||
return bx_write_configuration (rc, overwrite);
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::get_log_file (char *path, int len)
|
||||
bx_real_sim_c::get_log_file(char *path, int len)
|
||||
{
|
||||
strncpy (path, bx_options.log.Ofilename->getptr (), len);
|
||||
strncpy(path, SIM->get_param_string(BXPN_LOG_FILENAME)->getptr(), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::set_log_file (char *path)
|
||||
bx_real_sim_c::set_log_file(char *path)
|
||||
{
|
||||
bx_options.log.Ofilename->set (path);
|
||||
SIM->get_param_string(BXPN_LOG_FILENAME)->set(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::get_log_prefix (char *prefix, int len)
|
||||
bx_real_sim_c::get_log_prefix(char *prefix, int len)
|
||||
{
|
||||
strncpy (prefix, bx_options.log.Oprefix->getptr (), len);
|
||||
strncpy(prefix, SIM->get_param_string(BXPN_LOG_PREFIX)->getptr(), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::set_log_prefix (char *prefix)
|
||||
bx_real_sim_c::set_log_prefix(char *prefix)
|
||||
{
|
||||
bx_options.log.Oprefix->set (prefix);
|
||||
SIM->get_param_string(BXPN_LOG_PREFIX)->set(prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::get_debugger_log_file (char *path, int len)
|
||||
bx_real_sim_c::get_debugger_log_file(char *path, int len)
|
||||
{
|
||||
strncpy (path, bx_options.log.Odebugger_filename->getptr (), len);
|
||||
strncpy(path, SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr(), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::set_debugger_log_file (char *path)
|
||||
bx_real_sim_c::set_debugger_log_file(char *path)
|
||||
{
|
||||
bx_options.log.Odebugger_filename->set (path);
|
||||
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->set(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1622,8 +1565,8 @@ bx_list_c::bx_list_c(bx_param_c *parent, char *name, char *title,
|
|||
init(title);
|
||||
}
|
||||
|
||||
bx_list_c::bx_list_c(bx_id id, char *name, char *title, bx_param_c **init_list)
|
||||
: bx_param_c (id, name, NULL)
|
||||
bx_list_c::bx_list_c(bx_param_c *parent, char *name, char *title, bx_param_c **init_list)
|
||||
: bx_param_c((bx_id)SIM->gen_param_id(), name, NULL)
|
||||
{
|
||||
set_type(BXT_LIST);
|
||||
this->size = 0;
|
||||
|
@ -1633,8 +1576,13 @@ bx_list_c::bx_list_c(bx_id id, char *name, char *title, bx_param_c **init_list)
|
|||
this->list = new bx_param_c* [maxsize];
|
||||
for (int i=0; i<this->size; i++)
|
||||
this->list[i] = init_list[i];
|
||||
init(title);
|
||||
this->parent = NULL;
|
||||
if (parent) {
|
||||
BX_ASSERT(parent->get_type() == BXT_LIST);
|
||||
this->parent = (bx_list_c *)parent;
|
||||
this->parent->add(this);
|
||||
}
|
||||
init(title);
|
||||
}
|
||||
|
||||
bx_list_c::~bx_list_c()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.172 2006-03-04 12:43:47 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.173 2006-03-05 10:24:29 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Intro to siminterface by Bryce Denney:
|
||||
|
@ -217,6 +217,14 @@ typedef enum {
|
|||
#define BXPN_SB16_LOGLEVEL "sound.sb16.loglevel"
|
||||
#define BXPN_TEXT_SNAPSHOT_CHECK "misc.text_snapshot_check"
|
||||
#define BXPN_GDBSTUB "misc.gdbstub"
|
||||
#define BXPN_LOG_FILENAME "log.filename"
|
||||
#define BXPN_LOG_PREFIX "log.prefix"
|
||||
#define BXPN_DEBUGGER_LOG_FILENAME "log.debugger_filename"
|
||||
#define BXPN_BOCHS_START "general.start_mode"
|
||||
#define BXPN_DEBUG_RUNNING "general.debug_running"
|
||||
#define BXPN_MENU_DISK "menu.disk"
|
||||
#define BXPN_MENU_MEMORY "menu.memory"
|
||||
#define BXPN_MENU_RUNTIME "menu.runtime"
|
||||
|
||||
// base value for generated new parameter id
|
||||
#define BXP_NEW_PARAM_ID 1001
|
||||
|
@ -228,13 +236,6 @@ typedef enum {
|
|||
typedef enum {
|
||||
BXP_NULL = 301,
|
||||
|
||||
BXP_LOG_FILENAME,
|
||||
BXP_LOG_PREFIX,
|
||||
BXP_DEBUGGER_LOG_FILENAME,
|
||||
BXP_MENU_MEMORY,
|
||||
BXP_MENU_DISK,
|
||||
BXP_MENU_RUNTIME,
|
||||
BXP_BOCHS_START, // How Bochs starts
|
||||
// experiment: add params for CPU registers
|
||||
BXP_CPU_PARAMETERS,
|
||||
BXP_CPU_EAX,
|
||||
|
@ -305,11 +306,6 @@ typedef enum {
|
|||
BXP_KBD_TIMER_PENDING,
|
||||
BXP_KBD_IRQ1_REQ,
|
||||
BXP_KBD_IRQ12_REQ,
|
||||
#if BX_DEBUGGER
|
||||
// in debugger, is the simulation running (continue command) or waiting.
|
||||
// This is only modified by debugger code, not by the user.
|
||||
BXP_DEBUG_RUNNING,
|
||||
#endif
|
||||
BXP_THIS_IS_THE_LAST // used to determine length of list
|
||||
} bx_id;
|
||||
|
||||
|
@ -1006,9 +1002,9 @@ public:
|
|||
SHOW_GROUP_NAME = (1<<4)
|
||||
} bx_listopt_bits;
|
||||
bx_list_c(bx_id id, int maxsize = BX_DEFAULT_LIST_SIZE);
|
||||
bx_list_c(bx_id id, char *name, char *title, bx_param_c **init_list);
|
||||
bx_list_c(bx_id id, char *name, char *title, int maxsize = BX_DEFAULT_LIST_SIZE);
|
||||
bx_list_c(bx_param_c *parent, char *name, char *title, int maxsize = BX_DEFAULT_LIST_SIZE);
|
||||
bx_list_c(bx_param_c *parent, char *name, char *title, bx_param_c **init_list);
|
||||
virtual ~bx_list_c();
|
||||
bx_list_c *clone();
|
||||
void add(bx_param_c *param);
|
||||
|
@ -1172,12 +1168,8 @@ public:
|
|||
virtual void get_param_id_range(int *min, int *max) {}
|
||||
virtual int register_param(bx_id id, bx_param_c *it) {return -1;}
|
||||
virtual void reset_all_param() {}
|
||||
// deprecated param methods
|
||||
// deprecated param method
|
||||
virtual bx_param_c *get_param(bx_id id) {return NULL;}
|
||||
virtual bx_param_num_c *get_param_num(bx_id id) {return NULL;}
|
||||
virtual bx_param_string_c *get_param_string(bx_id id) {return NULL;}
|
||||
virtual bx_param_bool_c *get_param_bool(bx_id id) {return NULL;}
|
||||
virtual bx_param_enum_c *get_param_enum(bx_id id) {return NULL;}
|
||||
// new param methods
|
||||
virtual bx_param_c *get_param(const char *pname, bx_param_c *base=NULL) {return NULL;}
|
||||
virtual bx_param_num_c *get_param_num(const char *pname, bx_param_c *base=NULL) {return NULL;}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: term.cc,v 1.34 2006-02-21 21:35:08 vruppert Exp $
|
||||
// $Id: term.cc,v 1.35 2006-03-05 10:24:29 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2000 MandrakeSoft S.A.
|
||||
|
@ -197,8 +197,8 @@ bx_term_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsigned
|
|||
io->set_log_action(LOGLEV_PANIC, ACT_FATAL);
|
||||
// logfile should be different from stderr, otherwise terminal mode
|
||||
// really ends up having fun
|
||||
if (!strcmp(bx_options.log.Ofilename->getptr(), "-"))
|
||||
BX_PANIC(("cannot log to stderr in term mode"));
|
||||
if (!strcmp(SIM->get_param_string(BXPN_LOG_FILENAME)->getptr(), "-"))
|
||||
BX_PANIC(("cannot log to stderr in term mode"));
|
||||
|
||||
initscr();
|
||||
start_color();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: textconfig.cc,v 1.45 2006-03-04 12:43:47 vruppert Exp $
|
||||
// $Id: textconfig.cc,v 1.46 2006-03-05 10:24:29 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is code for a text-mode configuration interface. Note that this file
|
||||
|
@ -41,7 +41,6 @@ extern "C" {
|
|||
|
||||
#define BX_INSERTED 11
|
||||
|
||||
int do_menu2(const char *pname, bx_param_c *base);
|
||||
/* functions for changing particular options */
|
||||
void bx_config_interface_init();
|
||||
int bx_read_rc(char *rc);
|
||||
|
@ -350,35 +349,7 @@ void build_runtime_options_prompt(char *format, char *buf, int size)
|
|||
}
|
||||
#endif
|
||||
|
||||
int do_menu(bx_id id) {
|
||||
bx_list_c *menu = (bx_list_c *)SIM->get_param(id);
|
||||
while (1) {
|
||||
menu->get_choice()->set(0);
|
||||
int status = menu->text_ask(stdin, stderr);
|
||||
if (status < 0) return status;
|
||||
bx_param_num_c *choice = menu->get_choice();
|
||||
if (choice->get() < 1)
|
||||
return choice->get();
|
||||
else {
|
||||
int index = choice->get() - 1; // choosing 1 means list[0]
|
||||
bx_param_c *chosen = menu->get(index);
|
||||
assert (chosen != NULL);
|
||||
if (chosen->get_enabled()) {
|
||||
if (chosen->get_type() == BXT_LIST) {
|
||||
if (chosen->get_id() < BXP_NEW_PARAM_ID) {
|
||||
do_menu(chosen->get_id());
|
||||
} else {
|
||||
do_menu2(chosen->get_name(), chosen->get_parent());
|
||||
}
|
||||
} else {
|
||||
chosen->text_ask(stdin, stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int do_menu2(const char *pname, bx_param_c *base) {
|
||||
int do_menu(const char *pname, bx_param_c *base) {
|
||||
bx_list_c *menu = (bx_list_c *)SIM->get_param(pname, base);
|
||||
while (1) {
|
||||
menu->get_choice()->set(0);
|
||||
|
@ -393,11 +364,7 @@ int do_menu2(const char *pname, bx_param_c *base) {
|
|||
assert(chosen != NULL);
|
||||
if (chosen->get_enabled()) {
|
||||
if (chosen->get_type() == BXT_LIST) {
|
||||
if (chosen->get_id() < BXP_NEW_PARAM_ID) {
|
||||
do_menu(chosen->get_id());
|
||||
} else {
|
||||
do_menu2(chosen->get_name(), menu);
|
||||
}
|
||||
do_menu(chosen->get_name(), menu);
|
||||
} else {
|
||||
chosen->text_ask(stdin, stderr);
|
||||
}
|
||||
|
@ -406,10 +373,10 @@ int do_menu2(const char *pname, bx_param_c *base) {
|
|||
}
|
||||
}
|
||||
|
||||
void askparam (bx_id id)
|
||||
void askparam(char *pname)
|
||||
{
|
||||
bx_param_c *param = SIM->get_param (id);
|
||||
param->text_ask (stdin, stderr);
|
||||
bx_param_c *param = SIM->get_param(pname);
|
||||
param->text_ask(stdin, stderr);
|
||||
}
|
||||
|
||||
int bx_config_interface (int menu)
|
||||
|
@ -430,7 +397,7 @@ int bx_config_interface (int menu)
|
|||
case BX_CI_START_MENU:
|
||||
{
|
||||
Bit32u default_choice;
|
||||
switch (SIM->get_param_enum(BXP_BOCHS_START)->get ()) {
|
||||
switch (SIM->get_param_enum(BXPN_BOCHS_START)->get()) {
|
||||
case BX_LOAD_START:
|
||||
default_choice = 2; break;
|
||||
case BX_EDIT_START:
|
||||
|
@ -443,19 +410,19 @@ int bx_config_interface (int menu)
|
|||
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(BXP_BOCHS_START)->set(BX_EDIT_START);
|
||||
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 ();
|
||||
SIM->reset_all_param();
|
||||
if (bx_read_rc (NULL) >= 0)
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set(BX_RUN_START);
|
||||
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(BXP_BOCHS_START)->set(BX_RUN_START);
|
||||
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;
|
||||
|
@ -486,22 +453,22 @@ int bx_config_interface (int menu)
|
|||
if (ask_uint (prompt, 0, 16, 0, &choice, 10) < 0) return -1;
|
||||
switch (choice) {
|
||||
case 0: return 0;
|
||||
case 1: askparam (BXP_LOG_FILENAME); break;
|
||||
case 2: askparam (BXP_LOG_PREFIX); break;
|
||||
case 3: askparam (BXP_DEBUGGER_LOG_FILENAME); break;
|
||||
case 4: bx_log_options (0); break;
|
||||
case 5: bx_log_options (1); break;
|
||||
case 6: do_menu2("cpu", NULL); break;
|
||||
case 7: do_menu(BXP_MENU_MEMORY); break;
|
||||
case 8: do_menu2("clock_cmos", NULL); break;
|
||||
case 9: do_menu2("pci", NULL); break;
|
||||
case 10: do_menu2("display", NULL); break;
|
||||
case 11: do_menu2("keyboard_mouse", NULL); break;
|
||||
case 12: do_menu(BXP_MENU_DISK); break;
|
||||
case 13: do_menu2("ports", NULL); break;
|
||||
case 14: do_menu2("network", NULL); break;
|
||||
case 15: do_menu2(BXPN_SB16, NULL); break;
|
||||
case 16: do_menu2("misc", NULL); break;
|
||||
case 1: askparam(BXPN_LOG_FILENAME); break;
|
||||
case 2: askparam(BXPN_LOG_PREFIX); break;
|
||||
case 3: askparam(BXPN_DEBUGGER_LOG_FILENAME); break;
|
||||
case 4: bx_log_options(0); break;
|
||||
case 5: bx_log_options(1); break;
|
||||
case 6: do_menu("cpu", NULL); break;
|
||||
case 7: do_menu(BXPN_MENU_MEMORY, NULL); break;
|
||||
case 8: do_menu("clock_cmos", NULL); break;
|
||||
case 9: do_menu("pci", NULL); break;
|
||||
case 10: do_menu("display", NULL); break;
|
||||
case 11: do_menu("keyboard_mouse", NULL); break;
|
||||
case 12: do_menu(BXPN_MENU_DISK, NULL); break;
|
||||
case 13: do_menu("ports", NULL); break;
|
||||
case 14: do_menu("network", NULL); break;
|
||||
case 15: do_menu(BXPN_SB16, NULL); break;
|
||||
case 16: do_menu("misc", NULL); break;
|
||||
default: BAD_OPTION(menu, choice);
|
||||
}
|
||||
}
|
||||
|
@ -519,10 +486,10 @@ int bx_config_interface (int menu)
|
|||
#endif
|
||||
switch (choice) {
|
||||
case BX_CI_RT_FLOPPYA:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu2(BXPN_FLOPPYA, NULL);
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYA, NULL);
|
||||
break;
|
||||
case BX_CI_RT_FLOPPYB:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu2(BXPN_FLOPPYB, NULL);
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYB, NULL);
|
||||
break;
|
||||
case BX_CI_RT_CDROM1:
|
||||
case BX_CI_RT_CDROM2:
|
||||
|
@ -535,7 +502,7 @@ int bx_config_interface (int menu)
|
|||
SIM->get_param("model", cdromop)->set_enabled(0);
|
||||
SIM->get_param("biosdetect", cdromop)->set_enabled(0);
|
||||
cdromop->get_param_path(pname, 80);
|
||||
do_menu2(pname, NULL);
|
||||
do_menu(pname, NULL);
|
||||
}
|
||||
break;
|
||||
case BX_CI_RT_IPS:
|
||||
|
@ -546,7 +513,7 @@ int bx_config_interface (int menu)
|
|||
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 (BXP_MENU_RUNTIME); break;
|
||||
case BX_CI_RT_MISC: do_menu(BXPN_MENU_RUNTIME, NULL); 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");
|
||||
|
@ -1018,22 +985,22 @@ int bx_list_c::text_ask(FILE *fpin, FILE *fpout)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ci_callback (void *userdata, ci_command_t command)
|
||||
static int ci_callback(void *userdata, ci_command_t command)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case CI_START:
|
||||
bx_config_interface_init ();
|
||||
if (SIM->get_param_enum(BXP_BOCHS_START)->get () == BX_QUICK_START)
|
||||
bx_config_interface (BX_CI_START_SIMULATION);
|
||||
bx_config_interface_init();
|
||||
if (SIM->get_param_enum(BXPN_BOCHS_START)->get() == BX_QUICK_START)
|
||||
bx_config_interface(BX_CI_START_SIMULATION);
|
||||
else {
|
||||
if (!SIM->test_for_text_console ())
|
||||
if (!SIM->test_for_text_console())
|
||||
return CI_ERR_NO_TEXT_CONSOLE;
|
||||
bx_config_interface (BX_CI_START_MENU);
|
||||
bx_config_interface(BX_CI_START_MENU);
|
||||
}
|
||||
break;
|
||||
case CI_RUNTIME_CONFIG:
|
||||
bx_config_interface (BX_CI_RUNTIME);
|
||||
bx_config_interface(BX_CI_RUNTIME);
|
||||
break;
|
||||
case CI_SHUTDOWN:
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////
|
||||
// $Id: wxdialog.cc,v 1.88 2006-03-03 20:29:50 vruppert Exp $
|
||||
// $Id: wxdialog.cc,v 1.89 2006-03-05 10:24:29 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
|
@ -695,23 +695,23 @@ void AdvancedLogOptionsDialog::Init()
|
|||
Center ();
|
||||
}
|
||||
|
||||
void AdvancedLogOptionsDialog::CopyParamToGui () {
|
||||
bx_param_string_c *logfile = SIM->get_param_string (BXP_LOG_FILENAME);
|
||||
SetLogfile (wxString (logfile->getptr ()));
|
||||
void AdvancedLogOptionsDialog::CopyParamToGui() {
|
||||
bx_param_string_c *logfile = SIM->get_param_string(BXPN_LOG_FILENAME);
|
||||
SetLogfile (wxString (logfile->getptr()));
|
||||
// copy log action settings from siminterface to gui
|
||||
int dev, ndev = SIM->get_n_log_modules ();
|
||||
int type, ntype = SIM->get_max_log_level ();
|
||||
int dev, ndev = SIM->get_n_log_modules();
|
||||
int type, ntype = SIM->get_max_log_level();
|
||||
for (dev=0; dev<ndev; dev++) {
|
||||
for (type=0; type<ntype; type++) {
|
||||
SetAction (dev, type, SIM->get_log_action (dev, type));
|
||||
SetAction(dev, type, SIM->get_log_action(dev, type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AdvancedLogOptionsDialog::CopyGuiToParam () {
|
||||
void AdvancedLogOptionsDialog::CopyGuiToParam() {
|
||||
char buf[1024];
|
||||
safeWxStrcpy (buf, GetLogfile (), sizeof (buf));
|
||||
bx_param_string_c *logfile = SIM->get_param_string (BXP_LOG_FILENAME);
|
||||
safeWxStrcpy (buf, GetLogfile(), sizeof (buf));
|
||||
bx_param_string_c *logfile = SIM->get_param_string(BXPN_LOG_FILENAME);
|
||||
logfile->set (buf);
|
||||
// copy log action settings from gui to siminterface
|
||||
int dev, ndev = SIM->get_n_log_modules ();
|
||||
|
@ -1820,7 +1820,7 @@ CpuRegistersDialog::CopyParamToGui ()
|
|||
{
|
||||
ParamDialog::CopyParamToGui ();
|
||||
#if BX_DEBUGGER
|
||||
stateChanged (SIM->get_param_bool (BXP_DEBUG_RUNNING)->get ());
|
||||
stateChanged (SIM->get_param_bool(BXPN_DEBUG_RUNNING)->get());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////
|
||||
// $Id: wxmain.cc,v 1.126 2006-03-04 12:43:47 vruppert Exp $
|
||||
// $Id: wxmain.cc,v 1.127 2006-03-05 10:24:29 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// wxmain.cc implements the wxWidgets frame, toolbar, menus, and dialogs.
|
||||
|
@ -229,26 +229,26 @@ IMPLEMENT_APP_NO_MAIN(MyApp)
|
|||
bool MyApp::OnInit()
|
||||
{
|
||||
//wxLog::AddTraceMask (_T("mime"));
|
||||
wxLog::SetActiveTarget (new wxLogStderr ());
|
||||
bx_init_siminterface ();
|
||||
wxLog::SetActiveTarget (new wxLogStderr());
|
||||
bx_init_siminterface();
|
||||
// Install callback function to handle anything that occurs before the
|
||||
// simulation begins. This is responsible for displaying any error
|
||||
// dialogs during bochsrc and command line processing.
|
||||
SIM->set_notify_callback (&MyApp::DefaultCallback, this);
|
||||
MyFrame *frame = new MyFrame( "Bochs x86 Emulator", wxPoint(50,50), wxSize(450,340), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION );
|
||||
SIM->set_notify_callback(&MyApp::DefaultCallback, this);
|
||||
MyFrame *frame = new MyFrame("Bochs x86 Emulator", wxPoint(50,50), wxSize(450,340), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
|
||||
theFrame = frame; // hack alert
|
||||
frame->Show( TRUE );
|
||||
SetTopWindow( frame );
|
||||
wxTheClipboard->UsePrimarySelection (true);
|
||||
frame->Show(TRUE);
|
||||
SetTopWindow(frame);
|
||||
wxTheClipboard->UsePrimarySelection(true);
|
||||
// if quickstart is enabled, kick off the simulation
|
||||
if (SIM->get_param_enum(BXP_BOCHS_START)->get () == BX_QUICK_START) {
|
||||
if (SIM->get_param_enum(BXPN_BOCHS_START)->get() == BX_QUICK_START) {
|
||||
wxCommandEvent unusedEvent;
|
||||
frame->OnStartSim (unusedEvent);
|
||||
frame->OnStartSim(unusedEvent);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int MyApp::OnExit ()
|
||||
int MyApp::OnExit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -699,9 +699,9 @@ void MyFrame::OnLogPrefs(wxCommandEvent& WXUNUSED(event))
|
|||
// At least I can verify that the expected numbers are the same.
|
||||
wxASSERT (SIM->get_max_log_level() == LOG_OPTS_N_TYPES);
|
||||
LogOptionsDialog dlg (this, -1);
|
||||
bx_param_string_c *logfile = SIM->get_param_string (BXP_LOG_FILENAME);
|
||||
dlg.SetLogfile (wxString (logfile->getptr ()));
|
||||
bx_param_string_c *debuggerlogfile = SIM->get_param_string (BXP_DEBUGGER_LOG_FILENAME);
|
||||
bx_param_string_c *logfile = SIM->get_param_string(BXPN_LOG_FILENAME);
|
||||
dlg.SetLogfile (wxString (logfile->getptr()));
|
||||
bx_param_string_c *debuggerlogfile = SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME);
|
||||
dlg.SetDebuggerlogfile (wxString (debuggerlogfile->getptr ()));
|
||||
|
||||
// The inital values of the dialog are complicated. If the panic action
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.319 2006-03-04 16:58:10 sshwarts Exp $
|
||||
// $Id: main.cc,v 1.320 2006-03-05 10:24:27 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -473,13 +473,13 @@ int bx_init_main (int argc, char *argv[])
|
|||
SAFE_GET_GENLOG(); // never freed
|
||||
|
||||
// initalization must be done early because some destructors expect
|
||||
// the bx_options to exist by the time they are called.
|
||||
bx_init_bx_dbg ();
|
||||
bx_init_options ();
|
||||
// the bochs config options to exist by the time they are called.
|
||||
bx_init_bx_dbg();
|
||||
bx_init_options();
|
||||
|
||||
bx_print_header ();
|
||||
bx_print_header();
|
||||
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set (BX_RUN_START);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_RUN_START);
|
||||
|
||||
// interpret the args that start with -, like -q, -f, etc.
|
||||
int arg = 1, load_rcfile=1;
|
||||
|
@ -497,14 +497,14 @@ int bx_init_main (int argc, char *argv[])
|
|||
load_rcfile = 0;
|
||||
}
|
||||
else if (!strcmp ("-q", argv[arg])) {
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set (BX_QUICK_START);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
|
||||
}
|
||||
else if (!strcmp ("-f", argv[arg])) {
|
||||
if (++arg >= argc) BX_PANIC(("-f must be followed by a filename"));
|
||||
else bochsrc_filename = argv[arg];
|
||||
}
|
||||
else if (!strcmp ("-qf", argv[arg])) {
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set (BX_QUICK_START);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
|
||||
if (++arg >= argc) BX_PANIC(("-qf must be followed by a filename"));
|
||||
else bochsrc_filename = argv[arg];
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ int bx_init_main (int argc, char *argv[])
|
|||
arg = argc; // ignore all other args.
|
||||
setupWorkingDirectory (argv[0]);
|
||||
// there is no stdin/stdout so disable the text-based config interface.
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set (BX_QUICK_START);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
|
||||
char cwd[MAXPATHLEN];
|
||||
getwd (cwd);
|
||||
BX_INFO (("Now my working directory is %s", cwd));
|
||||
|
@ -583,7 +583,7 @@ int bx_init_main (int argc, char *argv[])
|
|||
if(!isatty(STDIN_FILENO))
|
||||
{
|
||||
// there is no stdin/stdout so disable the text-based config interface.
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set (BX_QUICK_START);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
|
||||
}
|
||||
BX_INFO (("fixing default lib location ..."));
|
||||
// locate the lib directory within the application bundle.
|
||||
|
@ -648,13 +648,13 @@ int bx_init_main (int argc, char *argv[])
|
|||
// No configuration was loaded, so the current settings are unusable.
|
||||
// Switch off quick start so that we will drop into the configuration
|
||||
// interface.
|
||||
if (SIM->get_param_enum(BXP_BOCHS_START)->get() == BX_QUICK_START) {
|
||||
if (!SIM->test_for_text_console ())
|
||||
if (SIM->get_param_enum(BXPN_BOCHS_START)->get() == BX_QUICK_START) {
|
||||
if (!SIM->test_for_text_console())
|
||||
BX_PANIC(("Unable to start Bochs without a bochsrc.txt and without a text console"));
|
||||
else
|
||||
BX_ERROR (("Switching off quick start, because no configuration file was found."));
|
||||
}
|
||||
SIM->get_param_enum(BXP_BOCHS_START)->set (BX_LOAD_START);
|
||||
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_LOAD_START);
|
||||
}
|
||||
|
||||
// parse the rest of the command line. This is done after reading the
|
||||
|
@ -840,7 +840,7 @@ int bx_init_hardware()
|
|||
{
|
||||
// all configuration has been read, now initialize everything.
|
||||
|
||||
if (SIM->get_param_enum(BXP_BOCHS_START)->get()==BX_QUICK_START) {
|
||||
if (SIM->get_param_enum(BXPN_BOCHS_START)->get()==BX_QUICK_START) {
|
||||
for (int level=0; level<N_LOGLEV; level++) {
|
||||
int action = SIM->get_default_log_action (level);
|
||||
io->set_log_action (level, action);
|
||||
|
@ -849,12 +849,12 @@ int bx_init_hardware()
|
|||
|
||||
bx_pc_system.init_ips(SIM->get_param_num(BXPN_IPS)->get());
|
||||
|
||||
if(bx_options.log.Ofilename->getptr()[0]!='-') {
|
||||
BX_INFO (("using log file %s", bx_options.log.Ofilename->getptr()));
|
||||
io->init_log(bx_options.log.Ofilename->getptr());
|
||||
if (SIM->get_param_string(BXPN_LOG_FILENAME)->getptr()[0]!='-') {
|
||||
BX_INFO (("using log file %s", SIM->get_param_string(BXPN_LOG_FILENAME)->getptr()));
|
||||
io->init_log(SIM->get_param_string(BXPN_LOG_FILENAME)->getptr());
|
||||
}
|
||||
|
||||
io->set_log_prefix(bx_options.log.Oprefix->getptr());
|
||||
io->set_log_prefix(SIM->get_param_string(BXPN_LOG_PREFIX)->getptr());
|
||||
|
||||
// Output to the log file the cpu and device settings
|
||||
// This will by handy for bug reports
|
||||
|
|
Loading…
Reference in New Issue