Replaced the plugin init / fini functions with one single function called

plugin_entry(). The additional boolean argument "init" is used to select the
requested action. The entry points still have unique names for compatibility
with the "non-plugin" compilation. Added macros for setting up these names
(e.g. PLUGIN_ENTRY_FOR_MODULE for device plugins).
This commit is contained in:
Volker Ruppert 2021-01-23 12:06:11 +00:00
parent e5c68dd4ac
commit 8db0a2b001
68 changed files with 708 additions and 937 deletions

View File

@ -41,8 +41,7 @@ enum plugintype_t {
PLUGTYPE_USB=0x500
};
typedef int (CDECL *plugin_init_t)(struct _plugin_t *plugin, plugintype_t type);
typedef void (CDECL *plugin_fini_t)(void);
typedef int (CDECL *plugin_entry_t)(struct _plugin_t *plugin, plugintype_t type, bool init);
typedef struct _plugin_t
{
@ -57,8 +56,7 @@ typedef struct _plugin_t
const char *name;
#endif
plugintype_t type;
plugin_init_t plugin_init;
plugin_fini_t plugin_fini;
plugin_entry_t plugin_entry;
bool initialized;
#if BX_PLUGINS
bool loaded;

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2020 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -572,12 +572,13 @@ enum {
// says:
// static bx_sdl_gui_c *theGui;
#define IMPLEMENT_GUI_PLUGIN_CODE(gui_name) \
int CDECL lib##gui_name##_gui_plugin_init(plugin_t *plugin, \
plugintype_t type) { \
genlog->info("installing %s module as the Bochs GUI", #gui_name); \
theGui = new bx_##gui_name##_gui_c (); \
bx_gui = theGui; \
return(0); /* Success */ \
} \
void CDECL lib##gui_name##_gui_plugin_fini(void) { }
#define IMPLEMENT_GUI_PLUGIN_CODE(gui_name) \
int CDECL lib##gui_name##_gui_plugin_entry(plugin_t *plugin, \
plugintype_t type, bool init) { \
if (init) { \
genlog->info("installing %s module as the Bochs GUI", #gui_name); \
theGui = new bx_##gui_name##_gui_c (); \
bx_gui = theGui; \
} \
return(0); /* Success */ \
}

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2020 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -209,22 +209,19 @@ static int ci_callback(void *userdata, ci_command_t command)
return 0;
}
extern "C" int libwx_gui_plugin_init(plugin_t *plugin, plugintype_t type)
extern "C" int libwx_gui_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
{
wxLogDebug(wxT("plugin_init for wxmain.cc"));
wxLogDebug(wxT("installing wxWidgets as the configuration interface"));
SIM->register_configuration_interface("wx", ci_callback, NULL);
wxLogDebug(wxT("installing %s as the Bochs GUI"), wxT("wxWidgets"));
SIM->get_param_enum(BXPN_SEL_DISPLAY_LIBRARY)->set_enabled(0);
MyPanel::OnPluginInit();
if (init) {
wxLogDebug(wxT("plugin_entry() for wxmain.cc"));
wxLogDebug(wxT("installing wxWidgets as the configuration interface"));
SIM->register_configuration_interface("wx", ci_callback, NULL);
wxLogDebug(wxT("installing %s as the Bochs GUI"), wxT("wxWidgets"));
SIM->get_param_enum(BXPN_SEL_DISPLAY_LIBRARY)->set_enabled(0);
MyPanel::OnPluginInit();
}
return 0; // success
}
extern "C" void libwx_gui_plugin_fini()
{
// Nothing here yet
}
//////////////////////////////////////////////////////////////////////
// MyApp: the wxWidgets application
@ -234,7 +231,7 @@ IMPLEMENT_APP_NO_MAIN(MyApp)
// this is the entry point of the wxWidgets code. It is called as follows:
// 1. main() loads the wxWidgets plugin (if necessary) and calls
// libwx_LTX_plugin_init, which installs a function pointer to the
// libwx_LTX_plugin_entry(), which installs a function pointer to the
// ci_callback() function.
// 2. main() calls SIM->configuration_interface.
// 3. bx_real_sim_c::configuration_interface calls the function pointer that

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2006-2020 The Bochs Project
// Copyright (C) 2006-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -66,20 +66,19 @@ const Bit8u acpi_sm_iomask[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, 0, 0
extern void apic_bus_deliver_smi(void);
int CDECL libacpi_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(acpi)
{
theACPIController = new bx_acpi_ctrl_c();
bx_devices.pluginACPIController = theACPIController;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theACPIController, BX_PLUGIN_ACPI);
if (init) {
theACPIController = new bx_acpi_ctrl_c();
bx_devices.pluginACPIController = theACPIController;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theACPIController, BX_PLUGIN_ACPI);
} else {
bx_devices.pluginACPIController = &bx_devices.stubACPIController;
delete theACPIController;
}
return 0; // Success
}
void CDECL libacpi_LTX_plugin_fini(void)
{
bx_devices.pluginACPIController = &bx_devices.stubACPIController;
delete theACPIController;
}
/* ported from QEMU: compute with 96 bit intermediate result: (a*b)/c */
Bit64u muldiv64(Bit64u a, Bit32u b, Bit32u c)
{

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2017 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -45,18 +45,17 @@ bx_biosdev_c *theBiosDevice = NULL;
#define bioslog theBiosDevice
logfunctions *vgabioslog;
int CDECL libbiosdev_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(biosdev)
{
theBiosDevice = new bx_biosdev_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theBiosDevice, BX_PLUGIN_BIOSDEV);
if (init) {
theBiosDevice = new bx_biosdev_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theBiosDevice, BX_PLUGIN_BIOSDEV);
} else {
delete theBiosDevice;
}
return(0); // Success
}
void CDECL libbiosdev_LTX_plugin_fini(void)
{
delete theBiosDevice;
}
bx_biosdev_c::bx_biosdev_c(void)
{
memset(&s, 0, sizeof(s));

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004-2017 The Bochs Project
// Copyright (C) 2004-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -79,20 +79,19 @@ bx_busm_c *theBusMouse = NULL;
#define READ_Y_HIGH (READ_Y | READ_HIGH)
int CDECL libbusmouse_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(busmouse)
{
// Create one instance of the busmouse device object.
theBusMouse = new bx_busm_c();
// Register this device.
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theBusMouse, BX_PLUGIN_BUSMOUSE);
if (init) {
// Create one instance of the busmouse device object.
theBusMouse = new bx_busm_c();
// Register this device.
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theBusMouse, BX_PLUGIN_BUSMOUSE);
} else {
delete theBusMouse;
}
return 0; // Success
}
void CDECL libbusmouse_LTX_plugin_fini(void)
{
delete theBusMouse;
}
bx_busm_c::bx_busm_c()
{
put("busmouse", "BUSM");

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2020 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -100,24 +100,23 @@ Bit8u bin_to_bcd(Bit8u value, bx_bool is_binary)
return ((value / 10) << 4) | (value % 10);
}
int CDECL libcmos_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(cmos)
{
if (type == PLUGTYPE_CORE) {
theCmosDevice = new bx_cmos_c();
bx_devices.pluginCmosDevice = theCmosDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theCmosDevice, BX_PLUGIN_CMOS);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
theCmosDevice = new bx_cmos_c();
bx_devices.pluginCmosDevice = theCmosDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theCmosDevice, BX_PLUGIN_CMOS);
} else {
return -1;
}
} else {
return -1;
}
}
void CDECL libcmos_LTX_plugin_fini(void)
{
if (theCmosDevice != NULL) {
delete theCmosDevice;
theCmosDevice = NULL;
if (theCmosDevice != NULL) {
delete theCmosDevice;
theCmosDevice = NULL;
}
}
return 0; // Success
}
bx_cmos_c::bx_cmos_c(void)

View File

@ -5,7 +5,7 @@
// Copyright (c) 2004 Makoto Suzuki (suzu)
// Volker Ruppert (vruppert)
// Robin Kay (komadori)
// Copyright (C) 2004-2020 The Bochs Project
// Copyright (C) 2004-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -212,21 +212,20 @@
static bx_svga_cirrus_c *theSvga = NULL;
int CDECL libsvga_cirrus_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(svga_cirrus)
{
if (type == PLUGTYPE_CORE) {
theSvga = new bx_svga_cirrus_c();
bx_devices.pluginVgaDevice = theSvga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSvga, BX_PLUGIN_CIRRUS);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
theSvga = new bx_svga_cirrus_c();
bx_devices.pluginVgaDevice = theSvga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSvga, BX_PLUGIN_CIRRUS);
} else {
return -1;
}
} else {
return -1;
delete theSvga;
}
}
void CDECL libsvga_cirrus_LTX_plugin_fini(void)
{
delete theSvga;
return 0; // Success
}
bx_svga_cirrus_c::bx_svga_cirrus_c() : bx_vgacore_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2020 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
// PCI VGA dummy adapter Copyright (C) 2002,2003 Mike Nordell
//
// This library is free software; you can redistribute it and/or
@ -44,21 +44,20 @@
bx_vga_c *theVga = NULL;
int CDECL libvga_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(vga)
{
if (type == PLUGTYPE_CORE) {
theVga = new bx_vga_c();
bx_devices.pluginVgaDevice = theVga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVga, BX_PLUGIN_VGA);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
theVga = new bx_vga_c();
bx_devices.pluginVgaDevice = theVga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVga, BX_PLUGIN_VGA);
} else {
return -1;
}
} else {
return -1;
delete theVga;
}
}
void CDECL libvga_LTX_plugin_fini(void)
{
delete theVga;
return 0; // Success
}
bx_vga_c::bx_vga_c() : bx_vgacore_c()

View File

@ -135,38 +135,37 @@ Bit32s voodoo_options_save(FILE *fp)
return SIM->write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_VOODOO), NULL, 0);
}
// device plugin entry points
// device plugin entry point
int CDECL libvoodoo_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(voodoo)
{
if (type == PLUGTYPE_VGA) {
theVoodooVga = new bx_voodoo_vga_c();
bx_devices.pluginVgaDevice = theVoodooVga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooVga, BX_PLUGIN_VOODOO);
if (init) {
if (type == PLUGTYPE_VGA) {
theVoodooVga = new bx_voodoo_vga_c();
bx_devices.pluginVgaDevice = theVoodooVga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooVga, BX_PLUGIN_VOODOO);
} else {
theVoodooDevice = new bx_voodoo_1_2_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooDevice, BX_PLUGIN_VOODOO);
}
// add new configuration parameter for the config interface
voodoo_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("voodoo", voodoo_options_parser, voodoo_options_save);
} else {
theVoodooDevice = new bx_voodoo_1_2_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooDevice, BX_PLUGIN_VOODOO);
SIM->unregister_addon_option("voodoo");
bx_list_c *menu = (bx_list_c*)SIM->get_param("display");
menu->remove("voodoo");
if (theVoodooVga != NULL) {
delete theVoodooVga;
}
if (theVoodooDevice != NULL) {
delete theVoodooDevice;
}
}
// add new configuration parameter for the config interface
voodoo_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("voodoo", voodoo_options_parser, voodoo_options_save);
return 0; // Success
}
void CDECL libvoodoo_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("voodoo");
bx_list_c *menu = (bx_list_c*)SIM->get_param("display");
menu->remove("voodoo");
if (theVoodooVga != NULL) {
delete theVoodooVga;
}
if (theVoodooDevice != NULL) {
delete theVoodooDevice;
}
}
// FIFO thread
static bool voodoo_keep_alive = 0;

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2017 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -37,21 +37,20 @@
bx_dma_c *theDmaDevice = NULL;
int CDECL libdma_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(dma)
{
if (type == PLUGTYPE_CORE) {
theDmaDevice = new bx_dma_c ();
bx_devices.pluginDmaDevice = theDmaDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theDmaDevice, BX_PLUGIN_DMA);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
theDmaDevice = new bx_dma_c ();
bx_devices.pluginDmaDevice = theDmaDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theDmaDevice, BX_PLUGIN_DMA);
} else {
return -1;
}
} else {
return -1;
delete theDmaDevice;
}
}
void CDECL libdma_LTX_plugin_fini(void)
{
delete theDmaDevice;
return 0; // Success
}
bx_dma_c::bx_dma_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2017 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -34,18 +34,17 @@
bx_extfpuirq_c *theExternalFpuIrq = NULL;
int CDECL libextfpuirq_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(extfpuirq)
{
theExternalFpuIrq = new bx_extfpuirq_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theExternalFpuIrq, BX_PLUGIN_EXTFPUIRQ);
if (init) {
theExternalFpuIrq = new bx_extfpuirq_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theExternalFpuIrq, BX_PLUGIN_EXTFPUIRQ);
} else {
delete theExternalFpuIrq;
}
return(0); // Success
}
void CDECL libextfpuirq_LTX_plugin_fini(void)
{
delete theExternalFpuIrq;
}
bx_extfpuirq_c::bx_extfpuirq_c(void)
{
put("extfpuirq", "EXFIRQ");

View File

@ -104,20 +104,19 @@ static Bit16u drate_in_k[4] = {
};
int CDECL libfloppy_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(floppy)
{
if (type == PLUGTYPE_CORE) {
theFloppyController = new bx_floppy_ctrl_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theFloppyController, BX_PLUGIN_FLOPPY);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
theFloppyController = new bx_floppy_ctrl_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theFloppyController, BX_PLUGIN_FLOPPY);
} else {
return -1;
}
} else {
return -1;
delete theFloppyController;
}
}
void CDECL libfloppy_LTX_plugin_fini(void)
{
delete theFloppyController;
return 0; // Success
}
bx_floppy_ctrl_c::bx_floppy_ctrl_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2017 The Bochs Project
// Copyright (C) 2003-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -57,20 +57,19 @@ UINT STDCALL joyGetPos(UINT, LPJOYINFO);
bx_gameport_c *theGameport = NULL;
int CDECL libgameport_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(gameport)
{
theGameport = new bx_gameport_c();
bx_devices.pluginGameport = theGameport;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theGameport, BX_PLUGIN_GAMEPORT);
if (init) {
theGameport = new bx_gameport_c();
bx_devices.pluginGameport = theGameport;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theGameport, BX_PLUGIN_GAMEPORT);
} else {
bx_devices.pluginGameport = &bx_devices.stubGameport;
delete theGameport;
}
return(0); // Success
}
void CDECL libgameport_LTX_plugin_fini(void)
{
bx_devices.pluginGameport = &bx_devices.stubGameport;
delete theGameport;
}
bx_gameport_c::bx_gameport_c()
{
put("gameport", "GAME");

View File

@ -109,19 +109,18 @@ BX_CPP_INLINE Bit32u read_32bit(const Bit8u* buf)
bx_hard_drive_c *theHardDrive = NULL;
logfunctions *atapilog = NULL;
int CDECL libharddrv_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(harddrv)
{
theHardDrive = new bx_hard_drive_c();
bx_devices.pluginHardDrive = theHardDrive;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theHardDrive, BX_PLUGIN_HARDDRV);
if (init) {
theHardDrive = new bx_hard_drive_c();
bx_devices.pluginHardDrive = theHardDrive;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theHardDrive, BX_PLUGIN_HARDDRV);
} else {
delete theHardDrive;
}
return(0); // Success
}
void CDECL libharddrv_LTX_plugin_fini(void)
{
delete theHardDrive;
}
bx_hard_drive_c::bx_hard_drive_c()
{
put("harddrv", "HD");

View File

@ -57,18 +57,13 @@ const int vbox_image_t::SECTOR_SIZE = 512;
#ifndef BXIMAGE
// disk image plugin entry points
// disk image plugin entry point
int CDECL libvbox_img_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_IMG_MODULE(vbox)
{
return 0; // Success
}
void CDECL libvbox_img_plugin_fini(void)
{
// Nothing here yet
}
#endif
//

View File

@ -52,18 +52,13 @@ const off_t vmware3_image_t::INVALID_OFFSET=(off_t)-1;
#ifndef BXIMAGE
// disk image plugin entry points
// disk image plugin entry point
int CDECL libvmware3_img_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_IMG_MODULE(vmware3)
{
return 0; // Success
}
void CDECL libvmware3_img_plugin_fini(void)
{
// Nothing here yet
}
#endif
//

View File

@ -56,18 +56,13 @@ const int vmware4_image_t::SECTOR_SIZE = 512;
#ifndef BXIMAGE
// disk image plugin entry points
// disk image plugin entry point
int CDECL libvmware4_img_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_IMG_MODULE(vmware4)
{
return 0; // Success
}
void CDECL libvmware4_img_plugin_fini(void)
{
// Nothing here yet
}
#endif
//

View File

@ -49,18 +49,13 @@
#ifndef BXIMAGE
// disk image plugin entry points
// disk image plugin entry point
int CDECL libvpc_img_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_IMG_MODULE(vpc)
{
return 0; // Success
}
void CDECL libvpc_img_plugin_fini(void)
{
// Nothing here yet
}
#endif
//

View File

@ -6,7 +6,7 @@
// ported from QEMU block driver with some additions (see below)
//
// Copyright (c) 2004,2005 Johannes E. Schindelin
// Copyright (C) 2010-2020 The Bochs Project
// Copyright (C) 2010-2021 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -59,18 +59,13 @@
#define VVFAT_BOOT "vvfat_boot.bin"
#define VVFAT_ATTR "vvfat_attr.cfg"
// disk image plugin entry points
// disk image plugin entry point
int CDECL libvvfat_img_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_IMG_MODULE(vvfat)
{
return 0; // Success
}
void CDECL libvvfat_img_plugin_fini(void)
{
// Nothing here yet
}
//
// Define the static class that registers the derived device image class,
// and allocates one on request.

View File

@ -9,7 +9,7 @@
//
// Authors: Beth Kon <bkon@us.ibm.com>
//
// Copyright (C) 2017-2020 The Bochs Project
// Copyright (C) 2017-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -41,20 +41,19 @@
bx_hpet_c *theHPET = NULL;
// device plugin entry points
// device plugin entry point
int CDECL libhpet_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(hpet)
{
theHPET = new bx_hpet_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theHPET, BX_PLUGIN_HPET);
if (init) {
theHPET = new bx_hpet_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theHPET, BX_PLUGIN_HPET);
} else {
delete theHPET;
}
return(0); // Success
}
void CDECL libhpet_LTX_plugin_fini(void)
{
delete theHPET;
}
// helper functions
// Start is assumed to be not later than end.

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2017 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -34,20 +34,19 @@
bx_ioapic_c *theIOAPIC = NULL;
int CDECL libioapic_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(ioapic)
{
theIOAPIC = new bx_ioapic_c();
bx_devices.pluginIOAPIC = theIOAPIC;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theIOAPIC, BX_PLUGIN_IOAPIC);
if (init) {
theIOAPIC = new bx_ioapic_c();
bx_devices.pluginIOAPIC = theIOAPIC;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theIOAPIC, BX_PLUGIN_IOAPIC);
} else {
bx_devices.pluginIOAPIC = &bx_devices.stubIOAPIC;
delete theIOAPIC;
}
return(0); // Success
}
void CDECL libioapic_LTX_plugin_fini(void)
{
bx_devices.pluginIOAPIC = &bx_devices.stubIOAPIC;
delete theIOAPIC;
}
static bx_bool ioapic_read(bx_phy_address a20addr, unsigned len, void *data, void *param)
{
if((a20addr & ~0x3) != ((a20addr+len-1) & ~0x3)) {

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -35,20 +35,19 @@
bx_iodebug_c *theIODebugDevice = NULL;
int CDECL libiodebug_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(iodebug)
{
theIODebugDevice = new bx_iodebug_c();
bx_devices.pluginIODebug = theIODebugDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theIODebugDevice, BX_PLUGIN_IODEBUG);
if (init) {
theIODebugDevice = new bx_iodebug_c();
bx_devices.pluginIODebug = theIODebugDevice;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theIODebugDevice, BX_PLUGIN_IODEBUG);
} else {
bx_devices.pluginIODebug = &bx_devices.stubIODebug;
delete theIODebugDevice;
}
return(0); // Success
}
void CDECL libiodebug_LTX_plugin_fini(void)
{
bx_devices.pluginIODebug = &bx_devices.stubIODebug;
delete theIODebugDevice;
}
struct bx_iodebug_s_type {
bx_bool enabled;
unsigned register_select;

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2020 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -56,20 +56,19 @@
bx_keyb_c *theKeyboard = NULL;
int CDECL libkeyboard_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(keyboard)
{
// Create one instance of the keyboard device object.
theKeyboard = new bx_keyb_c();
// Register this device.
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theKeyboard, BX_PLUGIN_KEYBOARD);
if (init) {
// Create one instance of the keyboard device object.
theKeyboard = new bx_keyb_c();
// Register this device.
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theKeyboard, BX_PLUGIN_KEYBOARD);
} else {
delete theKeyboard;
}
return 0; // Success
}
void CDECL libkeyboard_LTX_plugin_fini(void)
{
delete theKeyboard;
}
bx_keyb_c::bx_keyb_c()
{
put("keyboard", "KBD");

View File

@ -12,7 +12,7 @@
// Copyright (c) 2007 Dan Aloni
// Copyright (c) 2004 Antony T Curtis
//
// Copyright (C) 2011-2020 The Bochs Project
// Copyright (C) 2011-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -363,30 +363,29 @@ Bit32s e1000_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libe1000_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(e1000)
{
E1000DevMain = new bx_e1000_main_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, E1000DevMain, BX_PLUGIN_E1000);
// add new configuration parameter for the config interface
e1000_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("e1000", e1000_options_parser, e1000_options_save);
return 0; // Success
}
if (init) {
E1000DevMain = new bx_e1000_main_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, E1000DevMain, BX_PLUGIN_E1000);
// add new configuration parameter for the config interface
e1000_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("e1000", e1000_options_parser, e1000_options_save);
} else {
char name[12];
void CDECL libe1000_LTX_plugin_fini(void)
{
char name[12];
SIM->unregister_addon_option("e1000");
bx_list_c *network = (bx_list_c*)SIM->get_param("network");
for (Bit8u card = 0; card < BX_E1000_MAX_DEVS; card++) {
sprintf(name, "e1000_%d", card);
network->remove(name);
SIM->unregister_addon_option("e1000");
bx_list_c *network = (bx_list_c*)SIM->get_param("network");
for (Bit8u card = 0; card < BX_E1000_MAX_DEVS; card++) {
sprintf(name, "e1000_%d", card);
network->remove(name);
}
delete E1000DevMain;
}
delete E1000DevMain;
return 0; // Success
}
// macros and helper functions

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2020 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -53,19 +53,14 @@
#if BX_NETWORKING && BX_NETMOD_FBSD
// network driver plugin entry points
// network driver plugin entry point
int CDECL libfbsd_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(fbsd)
{
// Nothing here yet
return 0; // Success
}
void CDECL libfbsd_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -45,19 +45,14 @@
#if BX_NETWORKING && BX_NETMOD_LINUX
// network driver plugin entry points
// network driver plugin entry point
int CDECL liblinux_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(linux)
{
// Nothing here yet
return 0; // Success
}
void CDECL liblinux_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -36,19 +36,14 @@
#if BX_NETWORKING
// network driver plugin entry points
// network driver plugin entry point
int CDECL libnull_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(null)
{
// Nothing here yet
return 0; // Success
}
void CDECL libnull_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014-2020 The Bochs Project
// Copyright (C) 2014-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -38,18 +38,13 @@
static unsigned int bx_slirp_instances = 0;
// network driver plugin entry points
// network driver plugin entry point
int CDECL libslirp_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(slirp)
{
return 0; // Success
}
void CDECL libslirp_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -4,7 +4,7 @@
//
// Copyright (C) 2003 by Mariusz Matuszek
// [NOmrmmSPAM @ users.sourceforge.net]
// Copyright (C) 2017-2020 The Bochs Project
// Copyright (C) 2017-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -62,19 +62,14 @@
#if BX_NETWORKING && BX_NETMOD_SOCKET
// network driver plugin entry points
// network driver plugin entry point
int CDECL libsocket_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(socket)
{
// Nothing here yet
return 0; // Success
}
void CDECL libsocket_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -88,19 +88,14 @@
#if BX_NETWORKING && BX_NETMOD_TAP
// network driver plugin entry points
// network driver plugin entry point
int CDECL libtap_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(tap)
{
// Nothing here yet
return 0; // Success
}
void CDECL libtap_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -32,19 +32,14 @@
#if BX_NETWORKING && BX_NETMOD_TUNTAP
// network driver plugin entry points
// network driver plugin entry point
int CDECL libtuntap_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(tuntap)
{
// Nothing here yet
return 0; // Success
}
void CDECL libtuntap_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003 Renzo Davoli
// Copyright (C) 2003-2020 The Bochs Project
// Copyright (C) 2003-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -34,19 +34,14 @@
#if BX_NETWORKING && BX_NETMOD_VDE
// network driver plugin entry points
// network driver plugin entry point
int CDECL libvde_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(vde)
{
// Nothing here yet
return 0; // Success
}
void CDECL libvde_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004-2020 The Bochs Project
// Copyright (C) 2004-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -46,18 +46,13 @@
static unsigned int bx_vnet_instances = 0;
// network driver plugin entry points
// network driver plugin entry point
int CDECL libvnet_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(vnet)
{
return 0; // Success
}
void CDECL libvnet_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#define LOG_THIS netdev->

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2019 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -42,19 +42,14 @@
#if BX_NETWORKING && BX_NETMOD_WIN32
// network driver plugin entry points
// network driver plugin entry point
int CDECL libwin32_net_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_NET_MODULE(win32)
{
// Nothing here yet
return 0; // Success
}
void CDECL libwin32_net_plugin_fini(void)
{
// Nothing here yet
}
// network driver implementation
#ifndef __CYGWIN__

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2020 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -187,30 +187,29 @@ Bit32s ne2k_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libne2k_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(ne2k)
{
NE2kDevMain = new bx_ne2k_main_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, NE2kDevMain, BX_PLUGIN_NE2K);
// add new configuration parameter for the config interface
ne2k_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("ne2k", ne2k_options_parser, ne2k_options_save);
return(0); // Success
}
if (init) {
NE2kDevMain = new bx_ne2k_main_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, NE2kDevMain, BX_PLUGIN_NE2K);
// add new configuration parameter for the config interface
ne2k_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("ne2k", ne2k_options_parser, ne2k_options_save);
} else {
char name[12];
void CDECL libne2k_LTX_plugin_fini(void)
{
char name[12];
SIM->unregister_addon_option("ne2k");
bx_list_c *network = (bx_list_c*)SIM->get_param("network");
for (Bit8u card = 0; card < BX_NE2K_MAX_DEVS; card++) {
sprintf(name, "ne2k%d", card);
network->remove(name);
SIM->unregister_addon_option("ne2k");
bx_list_c *network = (bx_list_c*)SIM->get_param("network");
for (Bit8u card = 0; card < BX_NE2K_MAX_DEVS; card++) {
sprintf(name, "ne2k%d", card);
network->remove(name);
}
delete NE2kDevMain;
}
delete NE2kDevMain;
return(0); // Success
}
// the main object creates up to 4 device objects

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003 Fen Systems Ltd. (http://www.fensystems.co.uk/)
// Copyright (C) 2003-2018 The Bochs Project
// Copyright (C) 2003-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -95,27 +95,26 @@ Bit32s pnic_options_save(FILE *fp)
return SIM->write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_PNIC), NULL, 0);
}
// device plugin entry points
// device plugin entry point
int CDECL libpcipnic_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(pcipnic)
{
thePNICDevice = new bx_pcipnic_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePNICDevice, BX_PLUGIN_PCIPNIC);
// add new configuration parameter for the config interface
pnic_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("pcipnic", pnic_options_parser, pnic_options_save);
if (done) {
thePNICDevice = new bx_pcipnic_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePNICDevice, BX_PLUGIN_PCIPNIC);
// add new configuration parameter for the config interface
pnic_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("pcipnic", pnic_options_parser, pnic_options_save);
} else {
SIM->unregister_addon_option("pcipnic");
bx_list_c *menu = (bx_list_c*)SIM->get_param("network");
menu->remove("pnic");
delete thePNICDevice;
}
return 0; // Success
}
void CDECL libpcipnic_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("pcipnic");
bx_list_c *menu = (bx_list_c*)SIM->get_param("network");
menu->remove("pnic");
delete thePNICDevice;
}
// the device object
bx_pcipnic_c::bx_pcipnic_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2020 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -100,32 +100,31 @@ Bit32s parport_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libparallel_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(parallel)
{
theParallelDevice = new bx_parallel_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theParallelDevice, BX_PLUGIN_PARALLEL);
// add new configuration parameters for the config interface
parport_init_options();
// register add-on options for bochsrc and command line
SIM->register_addon_option("parport1", parport_options_parser, parport_options_save);
SIM->register_addon_option("parport2", parport_options_parser, NULL);
return 0; // Success
}
if (init) {
theParallelDevice = new bx_parallel_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theParallelDevice, BX_PLUGIN_PARALLEL);
// add new configuration parameters for the config interface
parport_init_options();
// register add-on options for bochsrc and command line
SIM->register_addon_option("parport1", parport_options_parser, parport_options_save);
SIM->register_addon_option("parport2", parport_options_parser, NULL);
} else {
char port[10];
void CDECL libparallel_LTX_plugin_fini(void)
{
char port[10];
delete theParallelDevice;
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.parallel");
for (int i=0; i<BX_N_PARALLEL_PORTS; i++) {
sprintf(port, "parport%d", i+1);
SIM->unregister_addon_option(port);
sprintf(port, "%d", i+1);
menu->remove(port);
delete theParallelDevice;
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.parallel");
for (int i=0; i<BX_N_PARALLEL_PORTS; i++) {
sprintf(port, "parport%d", i+1);
SIM->unregister_addon_option(port);
sprintf(port, "%d", i+1);
menu->remove(port);
}
}
return 0; // Success
}
// the device object

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2018 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -40,20 +40,19 @@ const char csname[3][20] = {"i430FX TSC", "i440FX PMC", "i440BX Host bridge"};
bx_pci_bridge_c *thePciBridge = NULL;
int CDECL libpci_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(pci)
{
if (type == PLUGTYPE_CORE) {
thePciBridge = new bx_pci_bridge_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciBridge, BX_PLUGIN_PCI);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
thePciBridge = new bx_pci_bridge_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciBridge, BX_PLUGIN_PCI);
} else {
return -1;
}
} else {
return -1;
delete thePciBridge;
}
}
void CDECL libpci_LTX_plugin_fini(void)
{
delete thePciBridge;
return 0; // Success
}
bx_pci_bridge_c::bx_pci_bridge_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2020 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -39,21 +39,20 @@
bx_piix3_c *thePci2IsaBridge = NULL;
int CDECL libpci2isa_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(pci2isa)
{
if (type == PLUGTYPE_CORE) {
thePci2IsaBridge = new bx_piix3_c();
bx_devices.pluginPci2IsaBridge = thePci2IsaBridge;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePci2IsaBridge, BX_PLUGIN_PCI2ISA);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
thePci2IsaBridge = new bx_piix3_c();
bx_devices.pluginPci2IsaBridge = thePci2IsaBridge;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePci2IsaBridge, BX_PLUGIN_PCI2ISA);
} else {
return -1;
}
} else {
return -1;
delete thePci2IsaBridge;
}
}
void CDECL libpci2isa_LTX_plugin_fini(void)
{
delete thePci2IsaBridge;
return 0; // Success
}
bx_piix3_c::bx_piix3_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004-2018 The Bochs Project
// Copyright (C) 2004-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -41,19 +41,18 @@ bx_pci_ide_c *thePciIdeController = NULL;
const Bit8u bmdma_iomask[16] = {1, 0, 1, 0, 4, 0, 0, 0, 1, 0, 1, 0, 4, 0, 0, 0};
int CDECL libpci_ide_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(pci_ide)
{
thePciIdeController = new bx_pci_ide_c();
bx_devices.pluginPciIdeController = thePciIdeController;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciIdeController, BX_PLUGIN_PCI_IDE);
if (init) {
thePciIdeController = new bx_pci_ide_c();
bx_devices.pluginPciIdeController = thePciIdeController;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciIdeController, BX_PLUGIN_PCI_IDE);
} else {
delete thePciIdeController;
}
return(0); // Success
}
void CDECL libpci_ide_LTX_plugin_fini(void)
{
delete thePciIdeController;
}
bx_pci_ide_c::bx_pci_ide_c()
{
put("pci_ide", "PIDE");

View File

@ -5,7 +5,7 @@
/*
* PCIDEV: PCI host device mapping
* Copyright (C) 2003 Frank Cornelis
* Copyright (C) 2003-2018 The Bochs Project
* Copyright (C) 2003-2021 The Bochs Project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -113,27 +113,26 @@ Bit32s pcidev_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libpcidev_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(pcidev)
{
thePciDevAdapter = new bx_pcidev_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciDevAdapter, BX_PLUGIN_PCIDEV);
// add new configuration parameter for the config interface
pcidev_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("pcidev", pcidev_options_parser, pcidev_options_save);
if (init) {
thePciDevAdapter = new bx_pcidev_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciDevAdapter, BX_PLUGIN_PCIDEV);
// add new configuration parameter for the config interface
pcidev_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("pcidev", pcidev_options_parser, pcidev_options_save);
} else {
SIM->unregister_addon_option("pcidev");
bx_list_c *menu = (bx_list_c*)SIM->get_param("network");
menu->remove("pcidev");
delete thePciDevAdapter;
}
return 0; // Success
}
void CDECL libpcidev_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("pcidev");
bx_list_c *menu = (bx_list_c*)SIM->get_param("network");
menu->remove("pcidev");
delete thePciDevAdapter;
}
// the device object
bx_pcidev_c::bx_pcidev_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2017 The Bochs Project
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -31,21 +31,20 @@
bx_pic_c *thePic = NULL;
int CDECL libpic_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(pic)
{
if (type == PLUGTYPE_CORE) {
thePic = new bx_pic_c();
bx_devices.pluginPicDevice = thePic;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePic, BX_PLUGIN_PIC);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
thePic = new bx_pic_c();
bx_devices.pluginPicDevice = thePic;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePic, BX_PLUGIN_PIC);
} else {
return -1;
}
} else {
return -1;
delete thePic;
}
}
void CDECL libpic_LTX_plugin_fini(void)
{
delete thePic;
return 0; // Success
}
bx_pic_c::bx_pic_c(void)

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2018 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -33,21 +33,20 @@
bx_pit_c *thePit = NULL;
int CDECL libpit_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(pit)
{
if (type == PLUGTYPE_CORE) {
thePit = new bx_pit_c();
bx_devices.pluginPitDevice = thePit;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePit, BX_PLUGIN_PIT);
return 0; // Success
if (init) {
if (type == PLUGTYPE_CORE) {
thePit = new bx_pit_c();
bx_devices.pluginPitDevice = thePit;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePit, BX_PLUGIN_PIT);
} else {
return -1;
}
} else {
return -1;
delete thePit;
}
}
void CDECL libpit_LTX_plugin_fini(void)
{
delete thePit;
return 0; // Success
}
//Important constant #defines:

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -149,34 +149,33 @@ Bit32s serial_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libserial_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(serial)
{
theSerialDevice = new bx_serial_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSerialDevice, BX_PLUGIN_SERIAL);
// add new configuration parameters for the config interface
serial_init_options();
// register add-on options for bochsrc and command line
SIM->register_addon_option("com1", serial_options_parser, serial_options_save);
SIM->register_addon_option("com2", serial_options_parser, NULL);
SIM->register_addon_option("com3", serial_options_parser, NULL);
SIM->register_addon_option("com4", serial_options_parser, NULL);
return 0; // Success
}
if (init) {
theSerialDevice = new bx_serial_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSerialDevice, BX_PLUGIN_SERIAL);
// add new configuration parameters for the config interface
serial_init_options();
// register add-on options for bochsrc and command line
SIM->register_addon_option("com1", serial_options_parser, serial_options_save);
SIM->register_addon_option("com2", serial_options_parser, NULL);
SIM->register_addon_option("com3", serial_options_parser, NULL);
SIM->register_addon_option("com4", serial_options_parser, NULL);
} else {
char port[6];
void CDECL libserial_LTX_plugin_fini(void)
{
char port[6];
delete theSerialDevice;
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.serial");
for (int i=0; i<BX_N_SERIAL_PORTS; i++) {
sprintf(port, "com%d", i+1);
SIM->unregister_addon_option(port);
sprintf(port, "%d", i+1);
menu->remove(port);
delete theSerialDevice;
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.serial");
for (int i=0; i<BX_N_SERIAL_PORTS; i++) {
sprintf(port, "com%d", i+1);
SIM->unregister_addon_option(port);
sprintf(port, "%d", i+1);
menu->remove(port);
}
}
return 0; // Success
}
// the device object

View File

@ -5,7 +5,7 @@
// ES1370 soundcard support (ported from QEMU)
//
// Copyright (c) 2005 Vassili Karpov (malc)
// Copyright (C) 2011-2020 The Bochs Project
// Copyright (C) 2011-2021 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -185,27 +185,26 @@ Bit32s es1370_options_save(FILE *fp)
return SIM->write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_SOUND_ES1370), NULL, 0);
}
// device plugin entry points
// device plugin entry point
int CDECL libes1370_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(es1370)
{
theES1370Device = new bx_es1370_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theES1370Device, BX_PLUGIN_ES1370);
// add new configuration parameter for the config interface
es1370_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("es1370", es1370_options_parser, es1370_options_save);
if (init) {
theES1370Device = new bx_es1370_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theES1370Device, BX_PLUGIN_ES1370);
// add new configuration parameter for the config interface
es1370_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("es1370", es1370_options_parser, es1370_options_save);
} else {
delete theES1370Device;
SIM->unregister_addon_option("es1370");
bx_list_c *menu = (bx_list_c*)SIM->get_param("sound");
menu->remove("es1370");
}
return 0; // Success
}
void CDECL libes1370_LTX_plugin_fini(void)
{
delete theES1370Device;
SIM->unregister_addon_option("es1370");
bx_list_c *menu = (bx_list_c*)SIM->get_param("sound");
menu->remove("es1370");
}
// the device object
bx_es1370_c::bx_es1370_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2020 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -161,26 +161,25 @@ Bit32s sb16_options_save(FILE *fp)
return SIM->write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_SOUND_SB16), NULL, 0);
}
// device plugin entry points
// device plugin entry point
int CDECL libsb16_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(sb16)
{
theSB16Device = new bx_sb16_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSB16Device, BX_PLUGIN_SB16);
// add new configuration parameter for the config interface
sb16_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("sb16", sb16_options_parser, sb16_options_save);
if (init) {
theSB16Device = new bx_sb16_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSB16Device, BX_PLUGIN_SB16);
// add new configuration parameter for the config interface
sb16_init_options();
// register add-on option for bochsrc and command line
SIM->register_addon_option("sb16", sb16_options_parser, sb16_options_save);
} else {
delete theSB16Device;
SIM->unregister_addon_option("sb16");
((bx_list_c*)SIM->get_param("sound"))->remove("sb16");
}
return(0); // Success
}
void CDECL libsb16_LTX_plugin_fini(void)
{
delete theSB16Device;
SIM->unregister_addon_option("sb16");
((bx_list_c*)SIM->get_param("sound"))->remove("sb16");
}
// some shortcuts to save typing
#define LOGFILE BX_SB16_THIS logfile
#define MPU BX_SB16_THIS mpu401.d

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2013-2017 The Bochs Project
// Copyright (C) 2013-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -35,19 +35,14 @@
#define LOG_THIS log->
// sound driver plugin entry points
// sound driver plugin entry point
int CDECL libalsa_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(alsa)
{
// Nothing here yet
return 0; // Success
}
void CDECL libalsa_sound_plugin_fini(void)
{
// Nothing here yet
}
// helper function for wavein / waveout
int alsa_pcm_open(bx_bool mode, alsa_pcm_t *alsa_pcm, bx_pcm_param_t *param, logfunctions *log)

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2017 The Bochs Project
// Copyright (C) 2011-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -31,17 +31,12 @@
#include "soundlow.h"
int CDECL libdummy_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(dummy)
{
// Nothing here yet
return 0; // Success
}
void CDECL libdummy_sound_plugin_fini(void)
{
// Nothing here yet
}
class bx_sound_dummy_c : public bx_sound_lowlevel_c {
public:
bx_sound_dummy_c() : bx_sound_lowlevel_c("dummy") {}

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -40,19 +40,14 @@
#define LOG_THIS
// sound driver plugin entry points
// sound driver plugin entry point
int CDECL libfile_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(file)
{
// Nothing here yet
return 0; // Success
}
void CDECL libfile_sound_plugin_fini(void)
{
// Nothing here yet
}
// bx_soundlow_waveout_file_c class implementation
bx_soundlow_waveout_file_c::bx_soundlow_waveout_file_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -40,19 +40,14 @@
#include <sys/ioctl.h>
#include <sys/soundcard.h>
// sound driver plugin entry points
// sound driver plugin entry point
int CDECL liboss_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(oss)
{
// Nothing here yet
return 0; // Success
}
void CDECL liboss_sound_plugin_fini(void)
{
// Nothing here yet
}
// bx_soundlow_waveout_oss_c class implementation
bx_soundlow_waveout_oss_c::bx_soundlow_waveout_oss_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004-2017 The Bochs Project
// Copyright (C) 2004-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -82,19 +82,14 @@ AudioUnit WaveOutputUnit = NULL;
AudioConverterRef WaveConverter = NULL;
#endif
// sound driver plugin entry points
// sound driver plugin entry point
int CDECL libosx_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(osx)
{
// Nothing here yet
return 0; // Success
}
void CDECL libosx_sound_plugin_fini(void)
{
// Nothing here yet
}
// bx_soundlow_waveout_osx_c class implementation
bx_soundlow_waveout_osx_c::bx_soundlow_waveout_osx_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2012-2017 The Bochs Project
// Copyright (C) 2012-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -36,19 +36,14 @@
#include <SDL.h>
// sound driver plugin entry points
// sound driver plugin entry point
int CDECL libsdl_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(sdl)
{
// Nothing here yet
return 0; // Success
}
void CDECL libsdl_sound_plugin_fini(void)
{
// Nothing here yet
}
// SDL audio callback
void sdl_callback(void *thisptr, Bit8u *stream, int len)

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -51,19 +51,14 @@
HANDLE DataHandle; // returned by GlobalAlloc()
Bit8u *DataPointer; // returned by GlobalLock()
// sound driver plugin entry points
// sound driver plugin entry point
int CDECL libwin_sound_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_SOUND_MODULE(win)
{
// Nothing here yet
return 0; // Success
}
void CDECL libwin_sound_plugin_fini(void)
{
// Nothing here yet
}
// helper function
Bit8u* newbuffer(unsigned blksize)
{

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003 David N. Welton <davidw@dedasys.com>.
// Copyright (C) 2003-2020 The Bochs Project
// Copyright (C) 2003-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -127,28 +127,27 @@ Bit32s speaker_options_save(FILE *fp)
return SIM->write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_SOUND_SPEAKER), NULL, 0);
}
// device plugin entry points
// device plugin entry point
int CDECL libspeaker_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(speaker)
{
theSpeaker = new bx_speaker_c();
bx_devices.pluginSpeaker = theSpeaker;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSpeaker, BX_PLUGIN_SPEAKER);
// add new configuration parameters for the config interface
speaker_init_options();
// register add-on options for bochsrc and command line
SIM->register_addon_option("speaker", speaker_options_parser, speaker_options_save);
if (init) {
theSpeaker = new bx_speaker_c();
bx_devices.pluginSpeaker = theSpeaker;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSpeaker, BX_PLUGIN_SPEAKER);
// add new configuration parameters for the config interface
speaker_init_options();
// register add-on options for bochsrc and command line
SIM->register_addon_option("speaker", speaker_options_parser, speaker_options_save);
} else {
bx_devices.pluginSpeaker = &bx_devices.stubSpeaker;
delete theSpeaker;
SIM->unregister_addon_option("speaker");
((bx_list_c*)SIM->get_param("sound"))->remove("speaker");
}
return(0); // Success
}
void CDECL libspeaker_LTX_plugin_fini(void)
{
bx_devices.pluginSpeaker = &bx_devices.stubSpeaker;
delete theSpeaker;
SIM->unregister_addon_option("speaker");
((bx_list_c*)SIM->get_param("sound"))->remove("speaker");
}
// the device object
bx_speaker_c::bx_speaker_c()

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -31,18 +31,17 @@
bx_unmapped_c *theUnmappedDevice = NULL;
int CDECL libunmapped_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(unmapped)
{
theUnmappedDevice = new bx_unmapped_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUnmappedDevice, BX_PLUGIN_UNMAPPED);
if (init) {
theUnmappedDevice = new bx_unmapped_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUnmappedDevice, BX_PLUGIN_UNMAPPED);
} else {
delete theUnmappedDevice;
}
return(0); // Success
}
void CDECL libunmapped_LTX_plugin_fini(void)
{
delete theUnmappedDevice;
}
bx_unmapped_c::bx_unmapped_c(void)
{
put("unmapped", "UNMAP");

View File

@ -45,18 +45,13 @@
#define LOG_THIS
// USB device plugin entry points
// USB device plugin entry point
int CDECL libusb_cbi_dev_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_USB_MODULE(usb_cbi)
{
return 0; // Success
}
void CDECL libusb_cbi_dev_plugin_fini(void)
{
// Nothing here yet
}
//
// Define the static class that registers the derived USB device class,
// and allocates one on request.

View File

@ -4,7 +4,7 @@
//
// Experimental USB EHCI adapter (partly ported from Qemu)
//
// Copyright (C) 2015-2019 The Bochs Project
// Copyright (C) 2015-2021 The Bochs Project
//
// Copyright(c) 2008 Emutex Ltd. (address@hidden)
// Copyright(c) 2011-2012 Red Hat, Inc.
@ -159,27 +159,26 @@ Bit32s usb_ehci_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libusb_ehci_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(usb_ehci)
{
theUSB_EHCI = new bx_usb_ehci_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_EHCI, BX_PLUGIN_USB_EHCI);
// add new configuration parameter for the config interface
SIM->init_usb_options("EHCI", "ehci", USB_EHCI_PORTS);
// register add-on option for bochsrc and command line
SIM->register_addon_option("usb_ehci", usb_ehci_options_parser, usb_ehci_options_save);
if (init) {
theUSB_EHCI = new bx_usb_ehci_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_EHCI, BX_PLUGIN_USB_EHCI);
// add new configuration parameter for the config interface
SIM->init_usb_options("EHCI", "ehci", USB_EHCI_PORTS);
// register add-on option for bochsrc and command line
SIM->register_addon_option("usb_ehci", usb_ehci_options_parser, usb_ehci_options_save);
} else {
SIM->unregister_addon_option("usb_ehci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_EHCI;
menu->remove("ehci");
}
return 0; // Success
}
void CDECL libusb_ehci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_ehci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_EHCI;
menu->remove("ehci");
}
// the device object
bx_usb_ehci_c::bx_usb_ehci_c()

View File

@ -8,7 +8,7 @@
//
// Copyright (c) 2005 Fabrice Bellard
// Copyright (c) 2007 OpenMoko, Inc. (andrew@openedhand.com)
// Copyright (C) 2009-2020 The Bochs Project
// Copyright (C) 2009-2021 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -60,18 +60,13 @@
#define LOG_THIS
// USB device plugin entry points
// USB device plugin entry point
int CDECL libusb_hid_dev_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_USB_MODULE(usb_hid)
{
return 0; // Success
}
void CDECL libusb_hid_dev_plugin_fini(void)
{
// Nothing here yet
}
//
// Define the static class that registers the derived USB device class,
// and allocates one on request.

View File

@ -5,7 +5,7 @@
// USB hub emulation support (ported from QEMU)
//
// Copyright (C) 2005 Fabrice Bellard
// Copyright (C) 2009-2020 The Bochs Project
// Copyright (C) 2009-2021 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -39,18 +39,13 @@
#define LOG_THIS
// USB device plugin entry points
// USB device plugin entry point
int CDECL libusb_hub_dev_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_USB_MODULE(usb_hub)
{
return 0; // Success
}
void CDECL libusb_hub_dev_plugin_fini(void)
{
// Nothing here yet
}
//
// Define the static class that registers the derived USB device class,
// and allocates one on request.

View File

@ -39,18 +39,13 @@
#define LOG_THIS
// USB device plugin entry points
// USB device plugin entry point
int CDECL libusb_msd_dev_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_USB_MODULE(usb_msd)
{
return 0; // Success
}
void CDECL libusb_msd_dev_plugin_fini(void)
{
// Nothing here yet
}
//
// Define the static class that registers the derived USB device class,
// and allocates one on request.

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net)
// 2009-2018 The Bochs Project
// 2009-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -105,27 +105,26 @@ Bit32s usb_ohci_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libusb_ohci_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(usb_ohci)
{
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
SIM->init_usb_options("OHCI", "ohci", 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);
if (init) {
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
SIM->init_usb_options("OHCI", "ohci", 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);
} else {
SIM->unregister_addon_option("usb_ohci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_OHCI;
menu->remove("ohci");
}
return 0; // Success
}
void CDECL libusb_ohci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_ohci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_OHCI;
menu->remove("ohci");
}
// the device object
bx_usb_ohci_c::bx_usb_ohci_c()

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net)
// 2009-2020 The Bochs Project
// 2009-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -34,18 +34,13 @@
#define LOG_THIS
// USB device plugin entry points
// USB device plugin entry point
int CDECL libusb_printer_dev_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_USB_MODULE(usb_printer)
{
return 0; // Success
}
void CDECL libusb_printer_dev_plugin_fini(void)
{
// Nothing here yet
}
//
// Define the static class that registers the derived USB device class,
// and allocates one on request.

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009-2015 Benjamin D Lunt (fys [at] fysnet [dot] net)
// 2009-2018 The Bochs Project
// 2009-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -77,27 +77,26 @@ Bit32s usb_uhci_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libusb_uhci_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(usb_uhci)
{
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
SIM->init_usb_options("UHCI", "uhci", 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);
if (init) {
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
SIM->init_usb_options("UHCI", "uhci", 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);
} else {
SIM->unregister_addon_option("usb_uhci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_UHCI;
menu->remove("uhci");
}
return 0; // Success
}
void CDECL libusb_uhci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_uhci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_UHCI;
menu->remove("uhci");
}
// the device object
bx_usb_uhci_c::bx_usb_uhci_c()

View File

@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2017 Benjamin D Lunt (fys [at] fysnet [dot] net)
// 2011-2018 The Bochs Project
// 2011-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -184,27 +184,26 @@ Bit32s usb_xhci_options_save(FILE *fp)
return 0;
}
// device plugin entry points
// device plugin entry point
int CDECL libusb_xhci_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
PLUGIN_ENTRY_FOR_MODULE(usb_xhci)
{
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
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);
if (init) {
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
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);
} else {
SIM->unregister_addon_option("usb_xhci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_XHCI;
menu->remove("xhci");
}
return 0; // Success
}
void CDECL libusb_xhci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_xhci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
delete theUSB_XHCI;
menu->remove("xhci");
}
// the device object
bx_usb_xhci_c::bx_usb_xhci_c()

View File

@ -941,7 +941,7 @@ bx_bool load_and_init_display_lib(void)
// bx_gui has already been filled in. This happens when you start
// the simulation for the second time.
// Also, if you load wxWidgets as the configuration interface. Its
// plugin_init will install wxWidgets as the bx_gui.
// plugin_entry() will install wxWidgets as the bx_gui.
return 1;
}
BX_ASSERT(bx_gui == NULL);

View File

@ -41,18 +41,12 @@
#define LOG_THIS genlog->
#define PLUGIN_INIT_FMT_STRING "lib%s_LTX_plugin_init"
#define PLUGIN_FINI_FMT_STRING "lib%s_LTX_plugin_fini"
#define GUI_PLUGIN_INIT_FMT_STRING "lib%s_gui_plugin_init"
#define GUI_PLUGIN_FINI_FMT_STRING "lib%s_gui_plugin_fini"
#define SOUND_PLUGIN_INIT_FMT_STRING "lib%s_sound_plugin_init"
#define SOUND_PLUGIN_FINI_FMT_STRING "lib%s_sound_plugin_fini"
#define NET_PLUGIN_INIT_FMT_STRING "lib%s_net_plugin_init"
#define NET_PLUGIN_FINI_FMT_STRING "lib%s_net_plugin_fini"
#define USB_PLUGIN_INIT_FMT_STRING "lib%s_dev_plugin_init"
#define USB_PLUGIN_FINI_FMT_STRING "lib%s_dev_plugin_fini"
#define IMG_PLUGIN_INIT_FMT_STRING "lib%s_img_plugin_init"
#define IMG_PLUGIN_FINI_FMT_STRING "lib%s_img_plugin_fini"
#define PLUGIN_ENTRY_FMT_STRING "lib%s_LTX_plugin_entry"
#define GUI_PLUGIN_ENTRY_FMT_STRING "lib%s_gui_plugin_entry"
#define SOUND_PLUGIN_ENTRY_FMT_STRING "lib%s_sound_plugin_entry"
#define NET_PLUGIN_ENTRY_FMT_STRING "lib%s_net_plugin_entry"
#define USB_PLUGIN_ENTRY_FMT_STRING "lib%s_dev_plugin_entry"
#define IMG_PLUGIN_ENTRY_FMT_STRING "lib%s_img_plugin_entry"
#define PLUGIN_PATH ""
#ifndef WIN32
@ -104,10 +98,6 @@ void (*pluginHRQHackCallback)(void);
unsigned pluginHRQ = 0;
plugin_t *plugins = NULL; /* Head of the linked list of plugins */
#if BX_PLUGINS
static bool plugin_init_one(plugin_t *plugin);
#endif
device_t *devices = NULL; /* Head of the linked list of registered devices */
device_t *core_devices = NULL; /* Head of the linked list of registered core devices */
@ -435,7 +425,7 @@ const char* bx_get_plugin_name(plugintype_t type, Bit8u index)
bool plugin_init_one(plugin_t *plugin)
{
/* initialize the plugin */
if (plugin->plugin_init(plugin, plugin->type))
if (plugin->plugin_entry(plugin, plugin->type, 1))
{
pluginlog->info("Plugin initialization failed for %s", plugin->name);
plugin_abort(plugin);
@ -450,7 +440,7 @@ bool plugin_unload(plugin_t *plugin)
{
if (plugin->loaded) {
if (plugin->initialized)
plugin->plugin_fini();
plugin->plugin_entry(plugin, plugin->type, 0);
#if defined(WIN32)
FreeLibrary(plugin->handle);
#else
@ -515,7 +505,7 @@ bool plugin_load(const char *name, plugintype_t type)
// Set context so that any devices that the plugin registers will
// be able to see which plugin created them. The registration will
// be called from either dlopen (global constructors) or plugin_init.
// be called from either dlopen (global constructors) or plugin_entry.
BX_ASSERT(current_plugin_context == NULL);
current_plugin_context = plugin;
#if defined(WIN32)
@ -551,62 +541,31 @@ bool plugin_load(const char *name, plugintype_t type)
plugin->loaded = 1;
if (type == PLUGTYPE_GUI) {
sprintf(tmpname, GUI_PLUGIN_INIT_FMT_STRING, name);
sprintf(tmpname, GUI_PLUGIN_ENTRY_FMT_STRING, name);
} else if (type == PLUGTYPE_SND) {
sprintf(tmpname, SOUND_PLUGIN_INIT_FMT_STRING, name);
sprintf(tmpname, SOUND_PLUGIN_ENTRY_FMT_STRING, name);
} else if (type == PLUGTYPE_NET) {
sprintf(tmpname, NET_PLUGIN_INIT_FMT_STRING, name);
sprintf(tmpname, NET_PLUGIN_ENTRY_FMT_STRING, name);
} else if (type == PLUGTYPE_USB) {
sprintf(tmpname, USB_PLUGIN_INIT_FMT_STRING, name);
sprintf(tmpname, USB_PLUGIN_ENTRY_FMT_STRING, name);
} else if (type == PLUGTYPE_IMG) {
sprintf(tmpname, IMG_PLUGIN_INIT_FMT_STRING, name);
sprintf(tmpname, IMG_PLUGIN_ENTRY_FMT_STRING, name);
} else if (type != PLUGTYPE_USER) {
sprintf(tmpname, PLUGIN_INIT_FMT_STRING, name);
sprintf(tmpname, PLUGIN_ENTRY_FMT_STRING, name);
} else {
sprintf(tmpname, PLUGIN_INIT_FMT_STRING, "user");
sprintf(tmpname, PLUGIN_ENTRY_FMT_STRING, "user");
}
#if defined(WIN32)
plugin->plugin_init = (plugin_init_t) GetProcAddress(plugin->handle, tmpname);
if (plugin->plugin_init == NULL) {
pluginlog->panic("could not find plugin_init: error=%d", GetLastError());
plugin->plugin_entry = (plugin_entry_t) GetProcAddress(plugin->handle, tmpname);
if (plugin->plugin_entry == NULL) {
pluginlog->panic("could not find plugin_entry: error=%d", GetLastError());
plugin_abort(plugin);
return 0;
}
#else
plugin->plugin_init = (plugin_init_t) lt_dlsym(plugin->handle, tmpname);
if (plugin->plugin_init == NULL) {
pluginlog->panic("could not find plugin_init: %s", lt_dlerror());
plugin_abort(plugin);
return 0;
}
#endif
if (type == PLUGTYPE_GUI) {
sprintf(tmpname, GUI_PLUGIN_FINI_FMT_STRING, name);
} else if (type == PLUGTYPE_SND) {
sprintf(tmpname, SOUND_PLUGIN_FINI_FMT_STRING, name);
} else if (type == PLUGTYPE_NET) {
sprintf(tmpname, NET_PLUGIN_FINI_FMT_STRING, name);
} else if (type == PLUGTYPE_USB) {
sprintf(tmpname, USB_PLUGIN_FINI_FMT_STRING, name);
} else if (type == PLUGTYPE_IMG) {
sprintf(tmpname, IMG_PLUGIN_FINI_FMT_STRING, name);
} else if (type != PLUGTYPE_USER) {
sprintf(tmpname, PLUGIN_FINI_FMT_STRING, name);
} else {
sprintf(tmpname, PLUGIN_FINI_FMT_STRING, "user");
}
#if defined(WIN32)
plugin->plugin_fini = (plugin_fini_t) GetProcAddress(plugin->handle, tmpname);
if (plugin->plugin_fini == NULL) {
pluginlog->panic("could not find plugin_fini: error=%d", GetLastError());
plugin_abort(plugin);
return 0;
}
#else
plugin->plugin_fini = (plugin_fini_t) lt_dlsym(plugin->handle, tmpname);
if (plugin->plugin_fini == NULL) {
pluginlog->panic("could not find plugin_fini: %s", lt_dlerror());
plugin->plugin_entry = (plugin_entry_t) lt_dlsym(plugin->handle, tmpname);
if (plugin->plugin_entry == NULL) {
pluginlog->panic("could not find plugin_entry: %s", lt_dlerror());
plugin_abort(plugin);
return 0;
}
@ -803,7 +762,6 @@ bool bx_unload_plugin(const char *name, bx_bool devflag)
for (plugin = plugins; plugin; plugin = plugin->next) {
if (!strcmp(plugin->name, name)) {
BX_INFO(("bx_unload_plugin(): name = %s", plugin->name));
if (devflag) {
pluginUnregisterDeviceDevmodel(plugin->name);
}
@ -997,13 +955,13 @@ void bx_plugins_after_restore_state()
// Special code for loading gui, optional and sound plugins when plugin support
// is turned off.
#define BUILTIN_GUI_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_GUI, lib##mod##_gui_plugin_init, lib##mod##_gui_plugin_fini, 0}
#define BUILTIN_OPT_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_OPTIONAL, lib##mod##_LTX_plugin_init, lib##mod##_LTX_plugin_fini, 0}
#define BUILTIN_SND_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_SND, lib##mod##_sound_plugin_init, lib##mod##_sound_plugin_fini, 0}
#define BUILTIN_NET_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_NET, lib##mod##_net_plugin_init, lib##mod##_net_plugin_fini, 0}
#define BUILTIN_USB_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_USB, lib##mod##_dev_plugin_init, lib##mod##_dev_plugin_fini, 0}
#define BUILTIN_VGA_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_VGA, lib##mod##_LTX_plugin_init, lib##mod##_LTX_plugin_fini, 0}
#define BUILTIN_IMG_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_IMG, lib##mod##_img_plugin_init, lib##mod##_img_plugin_fini, 0}
#define BUILTIN_GUI_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_GUI, lib##mod##_gui_plugin_entry, 0}
#define BUILTIN_OPT_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_OPTIONAL, lib##mod##_LTX_plugin_entry, 0}
#define BUILTIN_SND_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_SND, lib##mod##_sound_plugin_entry, 0}
#define BUILTIN_NET_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_NET, lib##mod##_net_plugin_entry, 0}
#define BUILTIN_USB_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_USB, lib##mod##_dev_plugin_entry, 0}
#define BUILTIN_VGA_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_VGA, lib##mod##_LTX_plugin_entry, 0}
#define BUILTIN_IMG_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_IMG, lib##mod##_img_plugin_entry, 0}
plugin_t bx_builtin_plugins[] = {
#if BX_WITH_AMIGAOS
@ -1150,7 +1108,7 @@ plugin_t bx_builtin_plugins[] = {
BUILTIN_IMG_PLUGIN_ENTRY(vbox),
BUILTIN_IMG_PLUGIN_ENTRY(vpc),
BUILTIN_IMG_PLUGIN_ENTRY(vvfat),
{"NULL", PLUGTYPE_GUI, NULL, NULL, 0}
{"NULL", PLUGTYPE_GUI, NULL, 0}
};
int bx_load_plugin_np(const char *name, plugintype_t type)
@ -1160,7 +1118,7 @@ int bx_load_plugin_np(const char *name, plugintype_t type)
if ((!strcmp(name, bx_builtin_plugins[i].name)) &&
(type == bx_builtin_plugins[i].type)) {
if (bx_builtin_plugins[i].initialized == 0) {
bx_builtin_plugins[i].plugin_init(NULL, type);
bx_builtin_plugins[i].plugin_entry(NULL, type, 1);
bx_builtin_plugins[i].initialized = 1;
}
return 1;
@ -1180,7 +1138,7 @@ int bx_unload_opt_plugin(const char *name, bx_bool devflag)
if (devflag) {
pluginUnregisterDeviceDevmodel(bx_builtin_plugins[i].name);
}
bx_builtin_plugins[i].plugin_fini();
bx_builtin_plugins[i].plugin_entry(NULL, PLUGTYPE_OPTIONAL, 0);
bx_builtin_plugins[i].initialized = 0;
}
return 1;

View File

@ -111,13 +111,13 @@ extern "C" {
#else
// When plugins are off, PLUG_load_plugin will call the plugin_init function
// When plugins are off, PLUG_load_plugin will call the plugin_entry function
// directly.
#define PLUG_load_plugin(name,type) {lib##name##_LTX_plugin_init(NULL,type);}
#define PLUG_load_plugin(name,type) {lib##name##_LTX_plugin_entry(NULL,type,1);}
#define PLUG_load_gui_plugin(name) bx_load_plugin_np(name,PLUGTYPE_GUI)
#define PLUG_load_opt_plugin(name) bx_load_plugin_np(name,PLUGTYPE_OPTIONAL)
#define PLUG_load_vga_plugin(name) bx_load_plugin_np(name,PLUGTYPE_VGA)
#define PLUG_unload_plugin(name) {lib##name##_LTX_plugin_fini();}
#define PLUG_unload_plugin(name) {lib##name##_LTX_plugin_entry(NULL,type,0);}
#define PLUG_unload_opt_plugin(name) bx_unload_opt_plugin(name,1)
#define DEV_register_ioread_handler(b,c,d,e,f) bx_devices.register_io_read_handler(b,c,d,e,f)
@ -355,134 +355,121 @@ int bx_load_plugin_np(const char *name, plugintype_t type);
int bx_unload_opt_plugin(const char *name, bx_bool devflag);
#endif
// every plugin must define these, within the extern"C" block, so that
// every plugin must define this, within the extern"C" block, so that
// a non-mangled function symbol is available in the shared library.
void plugin_fini(void);
int plugin_init(plugin_t *plugin, plugintype_t type);
int plugin_entry(plugin_t *plugin, plugintype_t type, bool init);
// still in extern "C"
#if BX_PLUGINS && defined(_MSC_VER)
#define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_LTX_plugin_init(plugin_t *plugin, plugintype_t type); \
extern "C" __declspec(dllexport) void __cdecl lib##mod##_LTX_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_gui_plugin_init(plugin_t *plugin, plugintype_t type); \
extern "C" __declspec(dllexport) void __cdecl lib##mod##_gui_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_sound_plugin_init(plugin_t *plugin, plugintype_t type); \
extern "C" __declspec(dllexport) void __cdecl lib##mod##_sound_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_net_plugin_init(plugin_t *plugin, plugintype_t type); \
extern "C" __declspec(dllexport) void __cdecl lib##mod##_net_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_dev_plugin_init(plugin_t *plugin, plugintype_t type); \
extern "C" __declspec(dllexport) void __cdecl lib##mod##_dev_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_img_plugin_init(plugin_t *plugin, plugintype_t type); \
extern "C" __declspec(dllexport) void __cdecl lib##mod##_img_plugin_fini(void);
#define PLUGIN_ENTRY_FOR_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_LTX_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_gui_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_SOUND_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_sound_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_NET_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_net_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_USB_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_dev_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
extern "C" __declspec(dllexport) int __cdecl lib##mod##_img_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#else
#define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \
int CDECL lib##mod##_LTX_plugin_init(plugin_t *plugin, plugintype_t type); \
void CDECL lib##mod##_LTX_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(mod) \
int CDECL lib##mod##_gui_plugin_init(plugin_t *plugin, plugintype_t type); \
void CDECL lib##mod##_gui_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(mod) \
int CDECL lib##mod##_sound_plugin_init(plugin_t *plugin, plugintype_t type); \
void CDECL lib##mod##_sound_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(mod) \
int CDECL lib##mod##_net_plugin_init(plugin_t *plugin, plugintype_t type); \
void CDECL lib##mod##_net_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(mod) \
int CDECL lib##mod##_dev_plugin_init(plugin_t *plugin, plugintype_t type); \
void CDECL lib##mod##_dev_plugin_fini(void);
#define DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(mod) \
int CDECL lib##mod##_img_plugin_init(plugin_t *plugin, plugintype_t type); \
void CDECL lib##mod##_img_plugin_fini(void);
#define PLUGIN_ENTRY_FOR_MODULE(mod) \
int CDECL lib##mod##_LTX_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
int CDECL lib##mod##_gui_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_SOUND_MODULE(mod) \
int CDECL lib##mod##_sound_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_NET_MODULE(mod) \
int CDECL lib##mod##_net_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_USB_MODULE(mod) \
int CDECL lib##mod##_dev_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
int CDECL lib##mod##_img_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
#endif
// device plugins
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(harddrv)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(keyboard)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(busmouse)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(serial)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(unmapped)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(biosdev)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(cmos)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(dma)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pic)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pit)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(vga)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(svga_cirrus)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(floppy)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(parallel)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci_ide)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcidev)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_uhci)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_ohci)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_ehci)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_xhci)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sb16)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(es1370)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(netmod)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ne2k)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcipnic)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(e1000)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(extfpuirq)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(gameport)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(speaker)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(acpi)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(iodebug)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ioapic)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(hpet)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(voodoo)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(user)
PLUGIN_ENTRY_FOR_MODULE(harddrv);
PLUGIN_ENTRY_FOR_MODULE(keyboard);
PLUGIN_ENTRY_FOR_MODULE(busmouse);
PLUGIN_ENTRY_FOR_MODULE(serial);
PLUGIN_ENTRY_FOR_MODULE(unmapped);
PLUGIN_ENTRY_FOR_MODULE(biosdev);
PLUGIN_ENTRY_FOR_MODULE(cmos);
PLUGIN_ENTRY_FOR_MODULE(dma);
PLUGIN_ENTRY_FOR_MODULE(pic);
PLUGIN_ENTRY_FOR_MODULE(pit);
PLUGIN_ENTRY_FOR_MODULE(vga);
PLUGIN_ENTRY_FOR_MODULE(svga_cirrus);
PLUGIN_ENTRY_FOR_MODULE(floppy);
PLUGIN_ENTRY_FOR_MODULE(parallel);
PLUGIN_ENTRY_FOR_MODULE(pci);
PLUGIN_ENTRY_FOR_MODULE(pci2isa);
PLUGIN_ENTRY_FOR_MODULE(pci_ide);
PLUGIN_ENTRY_FOR_MODULE(pcidev);
PLUGIN_ENTRY_FOR_MODULE(usb_uhci);
PLUGIN_ENTRY_FOR_MODULE(usb_ohci);
PLUGIN_ENTRY_FOR_MODULE(usb_ehci);
PLUGIN_ENTRY_FOR_MODULE(usb_xhci);
PLUGIN_ENTRY_FOR_MODULE(sb16);
PLUGIN_ENTRY_FOR_MODULE(es1370);
PLUGIN_ENTRY_FOR_MODULE(netmod);
PLUGIN_ENTRY_FOR_MODULE(ne2k);
PLUGIN_ENTRY_FOR_MODULE(pcipnic);
PLUGIN_ENTRY_FOR_MODULE(e1000);
PLUGIN_ENTRY_FOR_MODULE(extfpuirq);
PLUGIN_ENTRY_FOR_MODULE(gameport);
PLUGIN_ENTRY_FOR_MODULE(speaker);
PLUGIN_ENTRY_FOR_MODULE(acpi);
PLUGIN_ENTRY_FOR_MODULE(iodebug);
PLUGIN_ENTRY_FOR_MODULE(ioapic);
PLUGIN_ENTRY_FOR_MODULE(hpet);
PLUGIN_ENTRY_FOR_MODULE(voodoo);
PLUGIN_ENTRY_FOR_MODULE(user);
// gui plugins
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(amigaos)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(carbon)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(macintosh)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(nogui)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(rfb)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(sdl)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(sdl2)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(term)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(vncsrv)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(win32)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(wx)
DECLARE_PLUGIN_INIT_FINI_FOR_GUI_MODULE(x)
PLUGIN_ENTRY_FOR_GUI_MODULE(amigaos);
PLUGIN_ENTRY_FOR_GUI_MODULE(carbon);
PLUGIN_ENTRY_FOR_GUI_MODULE(macintosh);
PLUGIN_ENTRY_FOR_GUI_MODULE(nogui);
PLUGIN_ENTRY_FOR_GUI_MODULE(rfb);
PLUGIN_ENTRY_FOR_GUI_MODULE(sdl);
PLUGIN_ENTRY_FOR_GUI_MODULE(sdl2);
PLUGIN_ENTRY_FOR_GUI_MODULE(term);
PLUGIN_ENTRY_FOR_GUI_MODULE(vncsrv);
PLUGIN_ENTRY_FOR_GUI_MODULE(win32);
PLUGIN_ENTRY_FOR_GUI_MODULE(wx);
PLUGIN_ENTRY_FOR_GUI_MODULE(x);
// sound driver plugins
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(alsa)
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(dummy)
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(file)
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(oss)
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(osx)
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(sdl)
DECLARE_PLUGIN_INIT_FINI_FOR_SOUND_MODULE(win)
PLUGIN_ENTRY_FOR_SOUND_MODULE(alsa);
PLUGIN_ENTRY_FOR_SOUND_MODULE(dummy);
PLUGIN_ENTRY_FOR_SOUND_MODULE(file);
PLUGIN_ENTRY_FOR_SOUND_MODULE(oss);
PLUGIN_ENTRY_FOR_SOUND_MODULE(osx);
PLUGIN_ENTRY_FOR_SOUND_MODULE(sdl);
PLUGIN_ENTRY_FOR_SOUND_MODULE(win);
// network driver plugins
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(fbsd)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(linux)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(null)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(slirp)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(socket)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(tap)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(tuntap)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(vde)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(vnet)
DECLARE_PLUGIN_INIT_FINI_FOR_NET_MODULE(win32)
PLUGIN_ENTRY_FOR_NET_MODULE(fbsd);
PLUGIN_ENTRY_FOR_NET_MODULE(linux);
PLUGIN_ENTRY_FOR_NET_MODULE(null);
PLUGIN_ENTRY_FOR_NET_MODULE(slirp);
PLUGIN_ENTRY_FOR_NET_MODULE(socket);
PLUGIN_ENTRY_FOR_NET_MODULE(tap);
PLUGIN_ENTRY_FOR_NET_MODULE(tuntap);
PLUGIN_ENTRY_FOR_NET_MODULE(vde);
PLUGIN_ENTRY_FOR_NET_MODULE(vnet);
PLUGIN_ENTRY_FOR_NET_MODULE(win32);
// USB device plugins
DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(usb_cbi)
DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(usb_hid)
DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(usb_hub)
DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(usb_msd)
DECLARE_PLUGIN_INIT_FINI_FOR_USB_MODULE(usb_printer)
PLUGIN_ENTRY_FOR_USB_MODULE(usb_cbi);
PLUGIN_ENTRY_FOR_USB_MODULE(usb_hid);
PLUGIN_ENTRY_FOR_USB_MODULE(usb_hub);
PLUGIN_ENTRY_FOR_USB_MODULE(usb_msd);
PLUGIN_ENTRY_FOR_USB_MODULE(usb_printer);
// disk image plugins
DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(vmware3)
DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(vmware4)
DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(vbox)
DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(vpc)
DECLARE_PLUGIN_INIT_FINI_FOR_IMG_MODULE(vvfat)
PLUGIN_ENTRY_FOR_IMG_MODULE(vmware3);
PLUGIN_ENTRY_FOR_IMG_MODULE(vmware4);
PLUGIN_ENTRY_FOR_IMG_MODULE(vbox);
PLUGIN_ENTRY_FOR_IMG_MODULE(vpc);
PLUGIN_ENTRY_FOR_IMG_MODULE(vvfat);
#ifdef __cplusplus