diff --git a/bochs/.bochsrc b/bochs/.bochsrc index 8ebae948d..f0408a0db 100644 --- a/bochs/.bochsrc +++ b/bochs/.bochsrc @@ -1317,7 +1317,7 @@ speaker: enabled=1, mode=sound, volume=15 # port_e9_hack: enabled=1 # port_e9_hack: enabled=1, all_rings=1 #======================================================================= -#port_e9_hack: enabled=1 +#port_e9_hack: enabled=1, all_rings=1 #======================================================================= # IODEBUG: diff --git a/bochs/PARAM_TREE.txt b/bochs/PARAM_TREE.txt index f728baa5b..6885ac66d 100644 --- a/bochs/PARAM_TREE.txt +++ b/bochs/PARAM_TREE.txt @@ -285,7 +285,8 @@ sound misc port_e9_hack - port_e9_hack_all_rings + enabled + all_rings iodebug_all_rings gdbstub port diff --git a/bochs/config.cc b/bochs/config.cc index 8d32fc554..62efc95a7 100644 --- a/bochs/config.cc +++ b/bochs/config.cc @@ -239,13 +239,13 @@ void bx_init_usb_options(const char *usb_name, const char *pname, int maxports, // xhci host controller type and number of ports static const char *xhci_model_names[] = { "uPD720202", "uPD720201", NULL }; - bx_param_enum_c *model = new bx_param_enum_c(menu, + new bx_param_enum_c(menu, "model", "HC model", "Select Host Controller to emulate", xhci_model_names, 0, 0 ); - bx_param_num_c *n_ports = new bx_param_num_c(menu, + new bx_param_num_c(menu, "n_ports", "Number of ports", "Set the number of ports for this controller", -1, 10, @@ -1682,15 +1682,16 @@ void bx_init_options() misc->set_options(misc->SHOW_PARENT); // port e9 hack - new bx_param_bool_c(misc, - "port_e9_hack", + bx_list_c *port_e9_hack = new bx_list_c(misc, "port_e9_hack", "port 0xE9 hack"); + new bx_param_bool_c(port_e9_hack, + "enabled", "Enable port 0xE9 hack", "Debug messages written to i/o port 0xE9 will be displayed on console", 0); // port e9 hack all rings - new bx_param_bool_c(misc, - "port_e9_hack_all_rings", + new bx_param_bool_c(port_e9_hack, + "all_rings", "Enable port 0xE9 hack for all rings", "Debug messages written to i/o port 0xE9 from ring3 will be displayed on console", 0); @@ -2266,30 +2267,6 @@ static int parse_param_bool(const char *input, int len, const char *param) return -1; } -static int parse_port_e9_hack(const char *context, const char **params, int num_params) -{ - if (num_params > 2) { - PARSE_ERR(("%s: port_e9_hack directive: wrong # args.", context)); - } - if (strncmp(params[0], "enabled=", 8)) { - PARSE_ERR(("%s: port_e9_hack directive malformed.", context)); - } - if (parse_param_bool(params[0], 8, BXPN_PORT_E9_HACK) < 0) { - PARSE_ERR(("%s: port_e9_hack directive malformed.", context)); - } - if (num_params == 2) { - if (!strncmp(params[1], "all_rings=", 10)) { - if (parse_param_bool(params[1], 10, BXPN_PORT_E9_HACK_ALL_RINGS) < 0) { - PARSE_ERR(("%s: all_rings option malformed.", context)); - } - } else { - PARSE_ERR(("%s: port_e9_hack: invalid parameter %s", context, params[1])); - } - } - - return 0; -} - int bx_parse_param_from_list(const char *context, const char *input, bx_list_c *list) { char *propval, *property, *value; @@ -3262,8 +3239,10 @@ static int parse_line_formatted(const char *context, int num_params, char *param PARSE_ERR(("%s: print_timestamps directive malformed.", context)); } } else if (!strcmp(params[0], "port_e9_hack")) { - if (parse_port_e9_hack(context, (const char **)(params + 1), num_params - 1) < 0) { - return -1; + for (i=1; iget_param(BXPN_PORT_E9_HACK_ROOT)) < 0) { + PARSE_ERR(("%s: port_e9_hack directive malformed.", context)); + } } } else if (!strcmp(params[0], "iodebug")) { #if BX_SUPPORT_IODEBUG @@ -3634,11 +3613,10 @@ int bx_write_configuration(const char *rc, int overwrite) fprintf(fp, "print_timestamps: enabled=%d\n", bx_dbg.print_timestamps); bx_write_debugger_options(fp); - fprintf(fp, "port_e9_hack: enabled=%d\n", SIM->get_param_bool(BXPN_PORT_E9_HACK)->get()); - fprintf(fp, "port_e9_hack_all_rings: enabled=%d\n", SIM->get_param_bool(BXPN_PORT_E9_HACK_ALL_RINGS)->get()); - #if BX_SUPPORT_IODEBUG + bx_write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_PORT_E9_HACK_ROOT), NULL, 0); +#if BX_SUPPORT_IODEBUG fprintf(fp, "iodebug_all_rings: enabled=%d\n", SIM->get_param_bool(BXPN_IODEBUG_ALL_RINGS)->get()); - #endif +#endif fprintf(fp, "private_colormap: enabled=%d\n", SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get()); #if BX_WITH_AMIGAOS fprintf(fp, "fullscreen: enabled=%d\n", SIM->get_param_bool(BXPN_FULLSCREEN)->get()); diff --git a/bochs/cpu/io.cc b/bochs/cpu/io.cc index 3559d63f6..eff103895 100644 --- a/bochs/cpu/io.cc +++ b/bochs/cpu/io.cc @@ -865,7 +865,7 @@ bool BX_CPP_AttrRegparmN(3) BX_CPU_C::allow_io(bxInstruction_c *i, Bit16u port, * Otherwise, must check the IO permission map on >286. * On the 286, there is no IO permissions map */ - static bool port_e9_hack_all_rings = SIM->get_param_bool(BXPN_PORT_E9_HACK_ALL_RINGS)->get(); + static bool port_e9_hack_all_rings = SIM->get_param_bool(BXPN_PORT_E9_HACK)->get() && SIM->get_param_bool(BXPN_PORT_E9_HACK_ALL_RINGS)->get(); if (0xe9 == port && port_e9_hack_all_rings) return(1); // port e9 hack can be used by unprivileged code diff --git a/bochs/param_names.h b/bochs/param_names.h index 391c29853..1f1e6059d 100644 --- a/bochs/param_names.h +++ b/bochs/param_names.h @@ -174,8 +174,9 @@ #define BXPN_SOUND_SPEAKER "sound.speaker" #define BXPN_SOUND_SB16 "sound.sb16" #define BXPN_SOUND_ES1370 "sound.es1370" -#define BXPN_PORT_E9_HACK "misc.port_e9_hack" -#define BXPN_PORT_E9_HACK_ALL_RINGS "misc.port_e9_hack_all_rings" +#define BXPN_PORT_E9_HACK_ROOT "misc.port_e9_hack" +#define BXPN_PORT_E9_HACK "misc.port_e9_hack.enabled" +#define BXPN_PORT_E9_HACK_ALL_RINGS "misc.port_e9_hack.all_rings" #define BXPN_IODEBUG_ALL_RINGS "misc.iodebug_all_rings" #define BXPN_GDBSTUB "misc.gdbstub" #define BXPN_LOG_FILENAME "log.filename"