From: <vru...@us...> - 2012-01-16 17:11:22
|
Revision: 10986 http://bochs.svn.sourceforge.net/bochs/?rev=10986&view=rev Author: vruppert Date: 2012-01-16 17:11:16 +0000 (Mon, 16 Jan 2012) Log Message: ----------- - call functions for config and bochsrc parameter handling used by plugins from the siminterface (required by MSVC and maybe others) Modified Paths: -------------- trunk/bochs/gui/siminterface.cc trunk/bochs/gui/siminterface.h trunk/bochs/iodev/network/e1000.cc trunk/bochs/iodev/network/ne2k.cc trunk/bochs/iodev/network/pcipnic.cc trunk/bochs/iodev/usb/usb_ohci.cc trunk/bochs/iodev/usb/usb_uhci.cc trunk/bochs/iodev/usb/usb_xhci.cc Modified: trunk/bochs/gui/siminterface.cc =================================================================== --- trunk/bochs/gui/siminterface.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/gui/siminterface.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -188,6 +188,14 @@ return (bx_list_c*)get_param("bochs", NULL); } virtual bx_bool restore_bochs_param(bx_list_c *root, const char *sr_path, const char *restore_name); + // special config parameter and options functions for plugins + virtual void init_std_nic_options(const char *name, bx_list_c *menu); + virtual void init_usb_options(const char *usb_name, const char *pname, int maxports); + virtual int parse_nic_params(const char *context, const char *param, bx_list_c *base); + virtual int parse_usb_port_params(const char *context, bx_bool devopt, + const char *param, int maxports, bx_list_c *base); + virtual int write_pci_nic_options(FILE *fp, bx_list_c *base); + virtual int write_usb_options(FILE *fp, int maxports, bx_list_c *base); private: bx_bool save_sr_param(FILE *fp, bx_param_c *node, const char *sr_path, int level); @@ -1364,3 +1372,34 @@ return 1; } + +void bx_real_sim_c::init_std_nic_options(const char *name, bx_list_c *menu) +{ + bx_init_std_nic_options(name, menu); +} + +void bx_real_sim_c::init_usb_options(const char *usb_name, const char *pname, int maxports) +{ + bx_init_usb_options(usb_name, pname, maxports); +} + +int bx_real_sim_c::parse_nic_params(const char *context, const char *param, bx_list_c *base) +{ + return bx_parse_nic_params(context, param, base); +} + +int bx_real_sim_c::parse_usb_port_params(const char *context, bx_bool devopt, + const char *param, int maxports, bx_list_c *base) +{ + return bx_parse_usb_port_params(context, devopt, param, maxports, base); +} + +int bx_real_sim_c::write_pci_nic_options(FILE *fp, bx_list_c *base) +{ + return bx_write_pci_nic_options(fp, base); +} + +int bx_real_sim_c::write_usb_options(FILE *fp, int maxports, bx_list_c *base) +{ + return bx_write_usb_options(fp, maxports, base); +} Modified: trunk/bochs/gui/siminterface.h =================================================================== --- trunk/bochs/gui/siminterface.h 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/gui/siminterface.h 2012-01-16 17:11:16 UTC (rev 10986) @@ -724,6 +724,14 @@ virtual bx_bool restore_hardware() {return 0;} virtual bx_list_c *get_bochs_root() {return NULL;} virtual bx_bool restore_bochs_param(bx_list_c *root, const char *sr_path, const char *restore_name) { return 0; } + // special config parameter and options functions for plugins + virtual void init_std_nic_options(const char *name, bx_list_c *menu) {} + virtual void init_usb_options(const char *usb_name, const char *pname, int maxports) {} + virtual int parse_nic_params(const char *context, const char *param, bx_list_c *base) {return 0;} + virtual int parse_usb_port_params(const char *context, bx_bool devopt, + const char *param, int maxports, bx_list_c *base) {return 0;} + virtual int write_pci_nic_options(FILE *fp, bx_list_c *base) {return 0;} + virtual int write_usb_options(FILE *fp, int maxports, bx_list_c *base) {return 0;} }; BOCHSAPI extern bx_simulator_interface_c *SIM; Modified: trunk/bochs/iodev/network/e1000.cc =================================================================== --- trunk/bochs/iodev/network/e1000.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/iodev/network/e1000.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -289,7 +289,7 @@ "Enable Intel(R) Gigabit Ethernet emulation", "Enables the Intel(R) Gigabit Ethernet emulation", 0); - bx_init_std_nic_options("Intel(R) Gigabit Ethernet", menu); + SIM->init_std_nic_options("Intel(R) Gigabit Ethernet", menu); enabled->set_dependent_list(menu->clone()); } @@ -303,7 +303,7 @@ SIM->get_param_enum("ethmod", base)->set_by_name("null"); } for (int i = 1; i < num_params; i++) { - ret = bx_parse_nic_params(context, params[i], base); + ret = SIM->parse_nic_params(context, params[i], base); if (ret > 0) { valid |= ret; } @@ -327,7 +327,7 @@ Bit32s e1000_options_save(FILE *fp) { - bx_write_pci_nic_options(fp, (bx_list_c*) SIM->get_param(BXPN_E1000)); + SIM->write_pci_nic_options(fp, (bx_list_c*) SIM->get_param(BXPN_E1000)); return 0; } Modified: trunk/bochs/iodev/network/ne2k.cc =================================================================== --- trunk/bochs/iodev/network/ne2k.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/iodev/network/ne2k.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -74,7 +74,7 @@ 0, 15, 9); irq->set_options(irq->USE_SPIN_CONTROL); - bx_init_std_nic_options("NE2K", menu); + SIM->init_std_nic_options("NE2K", menu); enabled->set_dependent_list(menu->clone()); } @@ -106,7 +106,7 @@ SIM->get_param_num("irq", base)->set(atol(¶ms[i][4])); valid |= 0x02; } else { - ret = bx_parse_nic_params(context, params[i], base); + ret = SIM->parse_nic_params(context, params[i], base); if (ret > 0) { valid |= ret; } Modified: trunk/bochs/iodev/network/pcipnic.cc =================================================================== --- trunk/bochs/iodev/network/pcipnic.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/iodev/network/pcipnic.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -51,7 +51,7 @@ "Enable Pseudo NIC emulation", "Enables the Pseudo NIC emulation", 0); - bx_init_std_nic_options("Pseudo NIC", menu); + SIM->init_std_nic_options("Pseudo NIC", menu); enabled->set_dependent_list(menu->clone()); } @@ -65,7 +65,7 @@ SIM->get_param_enum("ethmod", base)->set_by_name("null"); } for (int i = 1; i < num_params; i++) { - ret = bx_parse_nic_params(context, params[i], base); + ret = SIM->parse_nic_params(context, params[i], base); if (ret > 0) { valid |= ret; } @@ -89,7 +89,7 @@ Bit32s pnic_options_save(FILE *fp) { - bx_write_pci_nic_options(fp, (bx_list_c*) SIM->get_param(BXPN_PNIC)); + SIM->write_pci_nic_options(fp, (bx_list_c*) SIM->get_param(BXPN_PNIC)); return 0; } Modified: trunk/bochs/iodev/usb/usb_ohci.cc =================================================================== --- trunk/bochs/iodev/usb/usb_ohci.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/iodev/usb/usb_ohci.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -81,11 +81,11 @@ if (!strncmp(params[i], "enabled=", 8)) { SIM->get_param_bool(BXPN_OHCI_ENABLED)->set(atol(¶ms[i][8])); } else if (!strncmp(params[i], "port", 4)) { - if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_OHCI_PORTS, base) < 0) { + if (SIM->parse_usb_port_params(context, 0, params[i], BX_N_USB_OHCI_PORTS, base) < 0) { return -1; } } else if (!strncmp(params[i], "options", 7)) { - if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_OHCI_PORTS, base) < 0) { + if (SIM->parse_usb_port_params(context, 1, params[i], BX_N_USB_OHCI_PORTS, base) < 0) { return -1; } } else { @@ -101,7 +101,7 @@ Bit32s usb_ohci_options_save(FILE *fp) { bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_OHCI); - bx_write_usb_options(fp, BX_N_USB_OHCI_PORTS, base); + SIM->write_usb_options(fp, BX_N_USB_OHCI_PORTS, base); return 0; } @@ -112,7 +112,7 @@ theUSB_OHCI = new bx_usb_ohci_c(); BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_OHCI, BX_PLUGIN_USB_OHCI); // add new configuration parameter for the config interface - bx_init_usb_options("OHCI", "ohci", BX_N_USB_OHCI_PORTS); + SIM->init_usb_options("OHCI", "ohci", BX_N_USB_OHCI_PORTS); // register add-on option for bochsrc and command line SIM->register_addon_option("usb_ohci", usb_ohci_options_parser, usb_ohci_options_save); return 0; // Success Modified: trunk/bochs/iodev/usb/usb_uhci.cc =================================================================== --- trunk/bochs/iodev/usb/usb_uhci.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/iodev/usb/usb_uhci.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -54,11 +54,11 @@ if (!strncmp(params[i], "enabled=", 8)) { SIM->get_param_bool(BXPN_UHCI_ENABLED)->set(atol(¶ms[i][8])); } else if (!strncmp(params[i], "port", 4)) { - if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_UHCI_PORTS, base) < 0) { + if (SIM->parse_usb_port_params(context, 0, params[i], BX_N_USB_UHCI_PORTS, base) < 0) { return -1; } } else if (!strncmp(params[i], "options", 7)) { - if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_UHCI_PORTS, base) < 0) { + if (SIM->parse_usb_port_params(context, 1, params[i], BX_N_USB_UHCI_PORTS, base) < 0) { return -1; } } else { @@ -74,7 +74,7 @@ Bit32s usb_uhci_options_save(FILE *fp) { bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_UHCI); - bx_write_usb_options(fp, BX_N_USB_UHCI_PORTS, base); + SIM->write_usb_options(fp, BX_N_USB_UHCI_PORTS, base); return 0; } @@ -85,7 +85,7 @@ theUSB_UHCI = new bx_usb_uhci_c(); BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_UHCI, BX_PLUGIN_USB_UHCI); // add new configuration parameter for the config interface - bx_init_usb_options("UHCI", "uhci", BX_N_USB_UHCI_PORTS); + SIM->init_usb_options("UHCI", "uhci", BX_N_USB_UHCI_PORTS); // register add-on option for bochsrc and command line SIM->register_addon_option("usb_uhci", usb_uhci_options_parser, usb_uhci_options_save); return 0; // Success Modified: trunk/bochs/iodev/usb/usb_xhci.cc =================================================================== --- trunk/bochs/iodev/usb/usb_xhci.cc 2012-01-16 15:39:43 UTC (rev 10985) +++ trunk/bochs/iodev/usb/usb_xhci.cc 2012-01-16 17:11:16 UTC (rev 10986) @@ -78,11 +78,11 @@ if (!strncmp(params[i], "enabled=", 8)) { SIM->get_param_bool(BXPN_XHCI_ENABLED)->set(atol(¶ms[i][8])); } else if (!strncmp(params[i], "port", 4)) { - if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_XHCI_PORTS, base) < 0) { + if (SIM->parse_usb_port_params(context, 0, params[i], BX_N_USB_XHCI_PORTS, base) < 0) { return -1; } } else if (!strncmp(params[i], "options", 7)) { - if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_XHCI_PORTS, base) < 0) { + if (SIM->parse_usb_port_params(context, 1, params[i], BX_N_USB_XHCI_PORTS, base) < 0) { return -1; } } else { @@ -98,7 +98,7 @@ Bit32s usb_xhci_options_save(FILE *fp) { bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_XHCI); - bx_write_usb_options(fp, BX_N_USB_XHCI_PORTS, base); + SIM->write_usb_options(fp, BX_N_USB_XHCI_PORTS, base); return 0; } @@ -109,7 +109,7 @@ theUSB_XHCI = new bx_usb_xhci_c(); BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_XHCI, BX_PLUGIN_USB_XHCI); // add new configuration parameter for the config interface - bx_init_usb_options("xHCI", "xhci", BX_N_USB_XHCI_PORTS); + SIM->init_usb_options("xHCI", "xhci", BX_N_USB_XHCI_PORTS); // register add-on option for bochsrc and command line SIM->register_addon_option("usb_xhci", usb_xhci_options_parser, usb_xhci_options_save); return 0; // Success This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |