1 /////////////////////////////////////////////////////////////////////////
2 // $Id: plugin.h 14293 2021-06-27 14:50:26Z vruppert $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 //  Copyright (C) 2002-2021  The Bochs Project
6 //
7 //  This library is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU Lesser General Public
9 //  License as published by the Free Software Foundation; either
10 //  version 2 of the License, or (at your option) any later version.
11 //
12 //  This library is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //  Lesser General Public License for more details.
16 //
17 //  You should have received a copy of the GNU Lesser General Public
18 //  License along with this library; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20 //
21 /////////////////////////////////////////////////////////////////////////
22 //
23 // This file provides macros and types needed for plugins.  It is based on
24 // the plugin.h file from plex86, but with significant changes to make
25 // it work in Bochs.
26 // Plex86 is Copyright (C) 1999-2000  The plex86 developers team
27 //
28 /////////////////////////////////////////////////////////////////////////
29 
30 #ifndef __PLUGIN_H
31 #define __PLUGIN_H
32 
33 #include "extplugin.h"
34 
35 class BX_MEM_C;
36 class bx_devices_c;
37 BOCHSAPI extern logfunctions  *pluginlog;
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #define BX_PLUGIN_UNMAPPED  "unmapped"
44 #define BX_PLUGIN_BIOSDEV   "biosdev"
45 #define BX_PLUGIN_CMOS      "cmos"
46 #define BX_PLUGIN_VGA       "vga"
47 #define BX_PLUGIN_CIRRUS    "svga_cirrus"
48 #define BX_PLUGIN_FLOPPY    "floppy"
49 #define BX_PLUGIN_PARALLEL  "parallel"
50 #define BX_PLUGIN_SERIAL    "serial"
51 #define BX_PLUGIN_KEYBOARD  "keyboard"
52 #define BX_PLUGIN_BUSMOUSE  "busmouse"
53 #define BX_PLUGIN_HARDDRV   "harddrv"
54 #define BX_PLUGIN_DMA       "dma"
55 #define BX_PLUGIN_PIC       "pic"
56 #define BX_PLUGIN_PIT       "pit"
57 #define BX_PLUGIN_PCI       "pci"
58 #define BX_PLUGIN_PCI2ISA   "pci2isa"
59 #define BX_PLUGIN_PCI_IDE   "pci_ide"
60 #define BX_PLUGIN_SB16      "sb16"
61 #define BX_PLUGIN_ES1370    "es1370"
62 #define BX_PLUGIN_NE2K      "ne2k"
63 #define BX_PLUGIN_EXTFPUIRQ "extfpuirq"
64 #define BX_PLUGIN_PCIDEV    "pcidev"
65 #define BX_PLUGIN_USB_UHCI  "usb_uhci"
66 #define BX_PLUGIN_USB_OHCI  "usb_ohci"
67 #define BX_PLUGIN_USB_EHCI  "usb_ehci"
68 #define BX_PLUGIN_USB_XHCI  "usb_xhci"
69 #define BX_PLUGIN_PCIPNIC   "pcipnic"
70 #define BX_PLUGIN_E1000     "e1000"
71 #define BX_PLUGIN_GAMEPORT  "gameport"
72 #define BX_PLUGIN_SPEAKER   "speaker"
73 #define BX_PLUGIN_ACPI      "acpi"
74 #define BX_PLUGIN_IODEBUG   "iodebug"
75 #define BX_PLUGIN_IOAPIC    "ioapic"
76 #define BX_PLUGIN_HPET      "hpet"
77 #define BX_PLUGIN_VOODOO    "voodoo"
78 
79 
80 #define BX_REGISTER_DEVICE_DEVMODEL(a,b,c,d) pluginRegisterDeviceDevmodel(a,b,c,d)
81 #define BX_UNREGISTER_DEVICE_DEVMODEL(a,b) pluginUnregisterDeviceDevmodel(a,b)
82 #define PLUG_device_present(a) pluginDevicePresent(a)
83 
84 #if BX_PLUGINS
85 
86 // hardcoded load plugin macro for PLUGTYPE_CORE and PLUGTYPE_STANDARD
87 #define PLUG_load_plugin(name,type) {bx_load_plugin(#name,type);}
88 // newer plugin macros for variable plugin handling
89 #define PLUG_get_plugins_count(type) bx_get_plugins_count(type)
90 #define PLUG_get_plugin_name(type,index) bx_get_plugin_name(type,index)
91 #define PLUG_get_plugin_flags(type,index) bx_get_plugin_flags(type,index)
92 #define PLUG_load_plugin_var(name,type) {bx_load_plugin(name,type);}
93 #define PLUG_load_opt_plugin(name) bx_load_plugin(name,PLUGTYPE_OPTIONAL)
94 #define PLUG_unload_opt_plugin(name) bx_unload_plugin(name,1)
95 #define PLUG_unload_plugin_type(name,type) {bx_unload_plugin_type(name,type);}
96 
97 #define DEV_register_ioread_handler(b,c,d,e,f)  pluginRegisterIOReadHandler(b,c,d,e,f)
98 #define DEV_register_iowrite_handler(b,c,d,e,f) pluginRegisterIOWriteHandler(b,c,d,e,f)
99 #define DEV_unregister_ioread_handler(b,c,d,e)  pluginUnregisterIOReadHandler(b,c,d,e)
100 #define DEV_unregister_iowrite_handler(b,c,d,e) pluginUnregisterIOWriteHandler(b,c,d,e)
101 #define DEV_register_ioread_handler_range(b,c,d,e,f,g)  pluginRegisterIOReadHandlerRange(b,c,d,e,f,g)
102 #define DEV_register_iowrite_handler_range(b,c,d,e,f,g) pluginRegisterIOWriteHandlerRange(b,c,d,e,f,g)
103 #define DEV_unregister_ioread_handler_range(b,c,d,e,f)  pluginUnregisterIOReadHandlerRange(b,c,d,e,f)
104 #define DEV_unregister_iowrite_handler_range(b,c,d,e,f) pluginUnregisterIOWriteHandlerRange(b,c,d,e,f)
105 #define DEV_register_default_ioread_handler(b,c,d,e) pluginRegisterDefaultIOReadHandler(b,c,d,e)
106 #define DEV_register_default_iowrite_handler(b,c,d,e) pluginRegisterDefaultIOWriteHandler(b,c,d,e)
107 
108 #define DEV_register_irq(b,c) pluginRegisterIRQ(b,c)
109 #define DEV_unregister_irq(b,c) pluginUnregisterIRQ(b,c)
110 
111 #else
112 
113 // When plugins are off, PLUG_load_plugin will call the plugin_entry function
114 // directly (PLUGTYPE_CORE and PLUGTYPE_STANDARD only).
115 #define PLUG_load_plugin(name,type) {lib##name##_plugin_entry(NULL,type,PLUGIN_INIT);}
116 // Builtin plugins macros
117 #define PLUG_get_plugins_count(type) bx_get_plugins_count_np(type)
118 #define PLUG_get_plugin_name(type,index) bx_get_plugin_name_np(type,index)
119 #define PLUG_get_plugin_flags(type,index) bx_get_plugin_flags_np(type,index)
120 #define PLUG_load_plugin_var(name,type) bx_load_plugin_np(name,type)
121 #define PLUG_load_opt_plugin(name) bx_load_plugin_np(name,PLUGTYPE_OPTIONAL)
122 #define PLUG_unload_opt_plugin(name) bx_unload_opt_plugin(name,1)
123 
124 #define DEV_register_ioread_handler(b,c,d,e,f) bx_devices.register_io_read_handler(b,c,d,e,f)
125 #define DEV_register_iowrite_handler(b,c,d,e,f) bx_devices.register_io_write_handler(b,c,d,e,f)
126 #define DEV_unregister_ioread_handler(b,c,d,e)  bx_devices.unregister_io_read_handler(b,c,d,e)
127 #define DEV_unregister_iowrite_handler(b,c,d,e) bx_devices.unregister_io_write_handler(b,c,d,e)
128 #define DEV_register_ioread_handler_range(b,c,d,e,f,g)  bx_devices.register_io_read_handler_range(b,c,d,e,f,g)
129 #define DEV_register_iowrite_handler_range(b,c,d,e,f,g) bx_devices.register_io_write_handler_range(b,c,d,e,f,g)
130 #define DEV_unregister_ioread_handler_range(b,c,d,e,f)  bx_devices.unregister_io_read_handler_range(b,c,d,e,f)
131 #define DEV_unregister_iowrite_handler_range(b,c,d,e,f) bx_devices.unregister_io_write_handler_range(b,c,d,e,f)
132 #define DEV_register_default_ioread_handler(b,c,d,e) bx_devices.register_default_io_read_handler(b,c,d,e)
133 #define DEV_register_default_iowrite_handler(b,c,d,e) bx_devices.register_default_io_write_handler(b,c,d,e)
134 #define DEV_register_irq(b,c) bx_devices.register_irq(b,c)
135 #define DEV_unregister_irq(b,c) bx_devices.unregister_irq(b,c)
136 
137 #endif // #if BX_PLUGINS
138 
139 ///////// Common device macros
140 #define DEV_init_devices() {bx_devices.init(BX_MEM(0)); }
141 #define DEV_reset_devices(type) {bx_devices.reset(type); }
142 #define DEV_register_state() {bx_devices.register_state(); }
143 #define DEV_after_restore_state() {bx_devices.after_restore_state(); }
144 #define DEV_register_timer(a,b,c,d,e,f) bx_pc_system.register_timer(a,b,c,d,e,f)
145 
146 ///////// Removable devices macros
147 #define DEV_register_default_keyboard(a,b,c) (bx_devices.register_default_keyboard(a,b,c))
148 #define DEV_register_removable_keyboard(a,b,c,d) (bx_devices.register_removable_keyboard(a,b,c,d))
149 #define DEV_unregister_removable_keyboard(a) (bx_devices.unregister_removable_keyboard(a))
150 #define DEV_register_default_mouse(a,b,c) (bx_devices.register_default_mouse(a,b,c))
151 #define DEV_register_removable_mouse(a,b,c) (bx_devices.register_removable_mouse(a,b,c))
152 #define DEV_unregister_removable_mouse(a) (bx_devices.unregister_removable_mouse(a))
153 
154 ///////// I/O APIC macros
155 #define DEV_ioapic_present() (bx_devices.pluginIOAPIC != &bx_devices.stubIOAPIC)
156 #define DEV_ioapic_set_enabled(a,b) (bx_devices.pluginIOAPIC->set_enabled(a,b))
157 #define DEV_ioapic_receive_eoi(a) (bx_devices.pluginIOAPIC->receive_eoi(a))
158 #define DEV_ioapic_set_irq_level(a,b) (bx_devices.pluginIOAPIC->set_irq_level(a,b))
159 
160 ///////// CMOS macros
161 #define DEV_cmos_get_reg(a) (bx_devices.pluginCmosDevice->get_reg(a))
162 #define DEV_cmos_set_reg(a,b) (bx_devices.pluginCmosDevice->set_reg(a,b))
163 #define DEV_cmos_checksum() (bx_devices.pluginCmosDevice->checksum_cmos())
164 #define DEV_cmos_enable_irq(a) (bx_devices.pluginCmosDevice->enable_irq(a))
165 
166 ///////// PIT macro
167 #define DEV_pit_enable_irq(a) (bx_devices.pluginPitDevice->enable_irq(a))
168 
169 ///////// keyboard macros
170 #define DEV_kbd_gen_scancode(key) (bx_devices.gen_scancode(key))
171 #define DEV_kbd_paste_bytes(bytes, count) (bx_devices.paste_bytes(bytes,count))
172 #define DEV_kbd_release_keys() (bx_devices.release_keys())
173 #define DEV_kbd_set_indicator(a,b,c) (bx_devices.kbd_set_indicator(a,b,c))
174 
175 ///////// mouse macro
176 #define DEV_mouse_motion(dx, dy, dz, bs, absxy) (bx_devices.mouse_motion(dx, dy, dz, bs, absxy))
177 
178 ///////// hard drive macros
179 #define DEV_hd_read_handler(a, b, c) \
180     (bx_devices.pluginHardDrive->virt_read_handler(b, c))
181 #define DEV_hd_write_handler(a, b, c, d) \
182     (bx_devices.pluginHardDrive->virt_write_handler(b, c, d))
183 #define DEV_hd_bmdma_read_sector(a,b,c) bx_devices.pluginHardDrive->bmdma_read_sector(a,b,c)
184 #define DEV_hd_bmdma_write_sector(a,b) bx_devices.pluginHardDrive->bmdma_write_sector(a,b)
185 #define DEV_hd_bmdma_complete(a) bx_devices.pluginHardDrive->bmdma_complete(a)
186 
187 #define DEV_bulk_io_quantum_requested() (bx_devices.bulkIOQuantumsRequested)
188 #define DEV_bulk_io_quantum_transferred() (bx_devices.bulkIOQuantumsTransferred)
189 #define DEV_bulk_io_host_addr() (bx_devices.bulkIOHostAddr)
190 
191 ///////// DMA macros
192 #define DEV_dma_register_8bit_channel(channel, dmaRead, dmaWrite, name) \
193   (bx_devices.pluginDmaDevice->registerDMA8Channel(channel, dmaRead, dmaWrite, name))
194 #define DEV_dma_register_16bit_channel(channel, dmaRead, dmaWrite, name) \
195   (bx_devices.pluginDmaDevice->registerDMA16Channel(channel, dmaRead, dmaWrite, name))
196 #define DEV_dma_unregister_channel(channel) \
197   (bx_devices.pluginDmaDevice->unregisterDMAChannel(channel))
198 #define DEV_dma_set_drq(channel, val) \
199   (bx_devices.pluginDmaDevice->set_DRQ(channel, val))
200 #define DEV_dma_get_tc() \
201   (bx_devices.pluginDmaDevice->get_TC())
202 #define DEV_dma_raise_hlda() \
203   (bx_devices.pluginDmaDevice->raise_HLDA())
204 
205 ///////// PIC macros
206 #define DEV_pic_lower_irq(b)  (bx_devices.pluginPicDevice->lower_irq(b))
207 #define DEV_pic_raise_irq(b)  (bx_devices.pluginPicDevice->raise_irq(b))
208 #define DEV_pic_set_mode(a,b) (bx_devices.pluginPicDevice->set_mode(a,b))
209 #define DEV_pic_iac()         (bx_devices.pluginPicDevice->IAC())
210 
211 ///////// VGA macros
212 #define DEV_vga_redraw_area(left, top, right, bottom) \
213   (bx_devices.pluginVgaDevice->vga_redraw_area(left, top, right, bottom))
214 #define DEV_vga_get_text_snapshot(rawsnap, height, width) \
215   (bx_devices.pluginVgaDevice->get_text_snapshot(rawsnap, height, width))
216 #define DEV_vga_refresh(a) \
217   (bx_devices.pluginVgaDevice->refresh_display(bx_devices.pluginVgaDevice,a))
218 #define DEV_vga_set_override(a,b) (bx_devices.pluginVgaDevice->set_override(a,b))
219 
220 ///////// PCI macros
221 #define DEV_register_pci_handlers(a,b,c,d) \
222   (bx_devices.register_pci_handlers(a,b,c,d,0))
223 #define DEV_register_pci_handlers2(a,b,c,d,e) \
224   (bx_devices.register_pci_handlers(a,b,c,d,e))
225 #define DEV_pci_get_slot_mapping() bx_devices.pci_get_slot_mapping()
226 #define DEV_pci_get_confAddr() bx_devices.pci_get_confAddr()
227 #define DEV_pci_set_irq(a,b,c) bx_devices.pluginPci2IsaBridge->pci_set_irq(a,b,c)
228 #define DEV_pci_set_base_mem(a,b,c,d,e,f) \
229   (bx_devices.pci_set_base_mem(a,b,c,d,e,f))
230 #define DEV_pci_set_base_io(a,b,c,d,e,f,g,h) \
231   (bx_devices.pci_set_base_io(a,b,c,d,e,f,g,h))
232 #define DEV_ide_bmdma_present() bx_devices.pluginPciIdeController->bmdma_present()
233 #define DEV_ide_bmdma_set_irq(a) bx_devices.pluginPciIdeController->bmdma_set_irq(a)
234 #define DEV_ide_bmdma_start_transfer(a) \
235   bx_devices.pluginPciIdeController->bmdma_start_transfer(a)
236 #define DEV_acpi_generate_smi(a) bx_devices.pluginACPIController->generate_smi(a)
237 #define DEV_agp_present() (bx_devices.is_agp_present())
238 
239 ///////// Speaker macros
240 #define DEV_speaker_beep_on(frequency) bx_devices.pluginSpeaker->beep_on(frequency)
241 #define DEV_speaker_beep_off() bx_devices.pluginSpeaker->beep_off()
242 #define DEV_speaker_set_line(a) bx_devices.pluginSpeaker->set_line(a)
243 
244 ///////// Memory macros
245 #define DEV_register_memory_handlers(param,rh,wh,b,e) \
246     bx_devices.mem->registerMemoryHandlers(param,rh,wh,b,e)
247 #define DEV_unregister_memory_handlers(param,b,e) \
248     bx_devices.mem->unregisterMemoryHandlers(param,b,e)
249 #define DEV_mem_set_memory_type(a,b,c) \
250     bx_devices.mem->set_memory_type((memory_area_t)a,b,c)
251 #define DEV_mem_set_bios_write(a) bx_devices.mem->set_bios_write(a)
252 #define DEV_mem_set_bios_rom_access(a,b) bx_devices.mem->set_bios_rom_access(a,b)
253 
254 ///////// USB device macro
255 #define DEV_usb_init_device(a,b,c) bx_usbdev_ctl.init_device(a,b,(void**)c)
256 
257 ///////// Sound module macros
258 #define DEV_sound_get_waveout(a) (bx_soundmod_ctl.get_waveout(a))
259 #define DEV_sound_get_wavein() (bx_soundmod_ctl.get_wavein())
260 #define DEV_sound_get_midiout(a) (bx_soundmod_ctl.get_midiout(a))
261 
262 ///////// Networking module macro
263 #define DEV_net_init_module(a,b,c,d) \
264   ((eth_pktmover_c*)bx_netmod_ctl.init_module(a,(void*)b,(void*)c,d))
265 
266 ///////// Gameport macro
267 #if BX_SUPPORT_GAMEPORT
268 #define DEV_gameport_set_enabled(a) bx_devices.pluginGameport->set_enabled(a)
269 #else
270 #define DEV_gameport_set_enabled(a) BX_ERROR(("gameport emulation not present"))
271 #endif
272 
273 
274 #if BX_HAVE_DLFCN_H
275 #include <dlfcn.h>
276 #endif
277 
278 typedef Bit32u (*ioReadHandler_t)(void *, Bit32u, unsigned);
279 typedef void   (*ioWriteHandler_t)(void *, Bit32u, Bit32u, unsigned);
280 
281 typedef struct _device_t
282 {
283     const char   *name;
284     plugin_t     *plugin;
285     Bit16u       plugtype;
286 
287     class bx_devmodel_c *devmodel;  // BBD hack
288 
289     struct _device_t *next;
290 } device_t;
291 
292 
293 extern device_t *devices;
294 
295 void plugin_startup(void);
296 void plugin_cleanup(void);
297 
298 /* === Device Stuff === */
299 typedef void (*deviceInitMem_t)(BX_MEM_C *);
300 typedef void (*deviceInitDev_t)(void);
301 typedef void (*deviceReset_t)(unsigned);
302 
303 BOCHSAPI void pluginRegisterDeviceDevmodel(plugin_t *plugin, Bit16u type, bx_devmodel_c *dev, const char *name);
304 BOCHSAPI void pluginUnregisterDeviceDevmodel(const char *name, Bit16u type);
305 BOCHSAPI bool pluginDevicePresent(const char *name);
306 
307 /* === IO port stuff === */
308 BOCHSAPI extern int (*pluginRegisterIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
309                                 unsigned base, const char *name, Bit8u mask);
310 BOCHSAPI extern int (*pluginRegisterIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
311                                  unsigned base, const char *name, Bit8u mask);
312 BOCHSAPI extern int (*pluginUnregisterIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
313                                 unsigned base, Bit8u mask);
314 BOCHSAPI extern int (*pluginUnregisterIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
315                                  unsigned base, Bit8u mask);
316 BOCHSAPI extern int (*pluginRegisterIOReadHandlerRange)(void *thisPtr, ioReadHandler_t callback,
317                                 unsigned base, unsigned end, const char *name, Bit8u mask);
318 BOCHSAPI extern int (*pluginRegisterIOWriteHandlerRange)(void *thisPtr, ioWriteHandler_t callback,
319                                  unsigned base, unsigned end, const char *name, Bit8u mask);
320 BOCHSAPI extern int (*pluginUnregisterIOReadHandlerRange)(void *thisPtr, ioReadHandler_t callback,
321                                 unsigned begin, unsigned end, Bit8u mask);
322 BOCHSAPI extern int (*pluginUnregisterIOWriteHandlerRange)(void *thisPtr, ioWriteHandler_t callback,
323                                  unsigned begin, unsigned end, Bit8u mask);
324 BOCHSAPI extern int (*pluginRegisterDefaultIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
325                                 const char *name, Bit8u mask);
326 BOCHSAPI extern int (*pluginRegisterDefaultIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
327                                  const char *name, Bit8u mask);
328 
329 /* === IRQ stuff === */
330 BOCHSAPI extern void  (*pluginRegisterIRQ)(unsigned irq, const char *name);
331 BOCHSAPI extern void  (*pluginUnregisterIRQ)(unsigned irq, const char *name);
332 
333 /* === HRQ stuff === */
334 BOCHSAPI extern void    (*pluginSetHRQ)(unsigned val);
335 BOCHSAPI extern void    (*pluginSetHRQHackCallback)(void (*callback)(void));
336 
337 void plugin_abort(plugin_t *plugin);
338 
339 #if BX_PLUGINS
340 Bit8u bx_get_plugins_count(Bit16u type);
341 const char* bx_get_plugin_name(Bit16u type, Bit8u index);
342 Bit8u bx_get_plugin_flags(Bit16u type, Bit8u index);
343 #endif
344 bool bx_load_plugin(const char *name, Bit16u type);
345 bool bx_unload_plugin(const char *name, bool devflag);
346 extern void bx_unload_plugin_type(const char *name, Bit16u type);
347 extern void bx_init_plugins(void);
348 extern void bx_reset_plugins(unsigned);
349 extern void bx_unload_plugins(void);
350 extern void bx_plugins_register_state(void);
351 extern void bx_plugins_after_restore_state(void);
352 
353 #if !BX_PLUGINS
354 extern plugin_t bx_builtin_plugins[];
355 
356 Bit8u bx_get_plugins_count_np(Bit16u type);
357 const char* bx_get_plugin_name_np(Bit16u type, Bit8u index);
358 Bit8u bx_get_plugin_flags_np(Bit16u type, Bit8u index);
359 int bx_load_plugin_np(const char *name, Bit16u type);
360 int bx_unload_opt_plugin(const char *name, bool devflag);
361 #endif
362 
363 // every plugin must define this, within the extern"C" block, so that
364 // a non-mangled function symbol is available in the shared library.
365 int plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode);
366 
367 // still in extern "C"
368 #if BX_PLUGINS && defined(WIN32)
369 
370 #define PLUGIN_ENTRY_FOR_MODULE(mod) \
371   extern "C" __declspec(dllexport) int __cdecl lib##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
372 #define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
373   extern "C" __declspec(dllexport) int __cdecl lib##mod##_gui_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
374 #define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
375   extern "C" __declspec(dllexport) int __cdecl lib##mod##_img_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
376 #define PLUGIN_ENTRY_FOR_NET_MODULE(mod) \
377   extern "C" __declspec(dllexport) int __cdecl libeth_##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
378 #define PLUGIN_ENTRY_FOR_SND_MODULE(mod) \
379   extern "C" __declspec(dllexport) int __cdecl libsound##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
380 
381 #elif BX_PLUGINS
382 
383 #define PLUGIN_ENTRY_FOR_MODULE(mod) \
384   extern "C" int CDECL lib##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
385 #define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
386   extern "C" int CDECL lib##mod##_gui_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
387 #define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
388   extern "C" int CDECL lib##mod##_img_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
389 #define PLUGIN_ENTRY_FOR_NET_MODULE(mod) \
390   extern "C" int CDECL libeth_##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
391 #define PLUGIN_ENTRY_FOR_SND_MODULE(mod) \
392   extern "C" int CDECL libsound##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
393 
394 #else
395 
396 #define PLUGIN_ENTRY_FOR_MODULE(mod) \
397   int CDECL lib##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
398 #define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
399   int CDECL lib##mod##_gui_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
400 #define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
401   int CDECL lib##mod##_img_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
402 #define PLUGIN_ENTRY_FOR_NET_MODULE(mod) \
403   int CDECL libeth_##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
404 #define PLUGIN_ENTRY_FOR_SND_MODULE(mod) \
405   int CDECL libsound##mod##_plugin_entry(plugin_t *plugin, Bit16u type, Bit8u mode)
406 
407 // device plugins
408 PLUGIN_ENTRY_FOR_MODULE(harddrv);
409 PLUGIN_ENTRY_FOR_MODULE(keyboard);
410 PLUGIN_ENTRY_FOR_MODULE(busmouse);
411 PLUGIN_ENTRY_FOR_MODULE(serial);
412 PLUGIN_ENTRY_FOR_MODULE(unmapped);
413 PLUGIN_ENTRY_FOR_MODULE(biosdev);
414 PLUGIN_ENTRY_FOR_MODULE(cmos);
415 PLUGIN_ENTRY_FOR_MODULE(dma);
416 PLUGIN_ENTRY_FOR_MODULE(pic);
417 PLUGIN_ENTRY_FOR_MODULE(pit);
418 PLUGIN_ENTRY_FOR_MODULE(vga);
419 PLUGIN_ENTRY_FOR_MODULE(svga_cirrus);
420 PLUGIN_ENTRY_FOR_MODULE(floppy);
421 PLUGIN_ENTRY_FOR_MODULE(parallel);
422 PLUGIN_ENTRY_FOR_MODULE(pci);
423 PLUGIN_ENTRY_FOR_MODULE(pci2isa);
424 PLUGIN_ENTRY_FOR_MODULE(pci_ide);
425 PLUGIN_ENTRY_FOR_MODULE(pcidev);
426 PLUGIN_ENTRY_FOR_MODULE(usb_uhci);
427 PLUGIN_ENTRY_FOR_MODULE(usb_ohci);
428 PLUGIN_ENTRY_FOR_MODULE(usb_ehci);
429 PLUGIN_ENTRY_FOR_MODULE(usb_xhci);
430 PLUGIN_ENTRY_FOR_MODULE(sb16);
431 PLUGIN_ENTRY_FOR_MODULE(es1370);
432 PLUGIN_ENTRY_FOR_MODULE(netmod);
433 PLUGIN_ENTRY_FOR_MODULE(ne2k);
434 PLUGIN_ENTRY_FOR_MODULE(pcipnic);
435 PLUGIN_ENTRY_FOR_MODULE(e1000);
436 PLUGIN_ENTRY_FOR_MODULE(extfpuirq);
437 PLUGIN_ENTRY_FOR_MODULE(gameport);
438 PLUGIN_ENTRY_FOR_MODULE(speaker);
439 PLUGIN_ENTRY_FOR_MODULE(acpi);
440 PLUGIN_ENTRY_FOR_MODULE(iodebug);
441 PLUGIN_ENTRY_FOR_MODULE(ioapic);
442 PLUGIN_ENTRY_FOR_MODULE(hpet);
443 PLUGIN_ENTRY_FOR_MODULE(voodoo);
444 // config interface plugins
445 PLUGIN_ENTRY_FOR_MODULE(textconfig);
446 PLUGIN_ENTRY_FOR_MODULE(win32config);
447 // gui plugins
448 PLUGIN_ENTRY_FOR_GUI_MODULE(amigaos);
449 PLUGIN_ENTRY_FOR_GUI_MODULE(carbon);
450 PLUGIN_ENTRY_FOR_GUI_MODULE(macintosh);
451 PLUGIN_ENTRY_FOR_GUI_MODULE(nogui);
452 PLUGIN_ENTRY_FOR_GUI_MODULE(rfb);
453 PLUGIN_ENTRY_FOR_GUI_MODULE(sdl);
454 PLUGIN_ENTRY_FOR_GUI_MODULE(sdl2);
455 PLUGIN_ENTRY_FOR_GUI_MODULE(term);
456 PLUGIN_ENTRY_FOR_GUI_MODULE(vncsrv);
457 PLUGIN_ENTRY_FOR_GUI_MODULE(win32);
458 PLUGIN_ENTRY_FOR_GUI_MODULE(wx);
459 PLUGIN_ENTRY_FOR_GUI_MODULE(x);
460 // sound driver plugins
461 PLUGIN_ENTRY_FOR_SND_MODULE(alsa);
462 PLUGIN_ENTRY_FOR_SND_MODULE(dummy);
463 PLUGIN_ENTRY_FOR_SND_MODULE(file);
464 PLUGIN_ENTRY_FOR_SND_MODULE(oss);
465 PLUGIN_ENTRY_FOR_SND_MODULE(osx);
466 PLUGIN_ENTRY_FOR_SND_MODULE(sdl);
467 PLUGIN_ENTRY_FOR_SND_MODULE(win);
468 // network driver plugins
469 PLUGIN_ENTRY_FOR_NET_MODULE(fbsd);
470 PLUGIN_ENTRY_FOR_NET_MODULE(linux);
471 PLUGIN_ENTRY_FOR_NET_MODULE(null);
472 PLUGIN_ENTRY_FOR_NET_MODULE(slirp);
473 PLUGIN_ENTRY_FOR_NET_MODULE(socket);
474 PLUGIN_ENTRY_FOR_NET_MODULE(tap);
475 PLUGIN_ENTRY_FOR_NET_MODULE(tuntap);
476 PLUGIN_ENTRY_FOR_NET_MODULE(vde);
477 PLUGIN_ENTRY_FOR_NET_MODULE(vnet);
478 PLUGIN_ENTRY_FOR_NET_MODULE(win32);
479 // USB device plugins
480 PLUGIN_ENTRY_FOR_MODULE(usb_floppy);
481 PLUGIN_ENTRY_FOR_MODULE(usb_hid);
482 PLUGIN_ENTRY_FOR_MODULE(usb_hub);
483 PLUGIN_ENTRY_FOR_MODULE(usb_msd);
484 PLUGIN_ENTRY_FOR_MODULE(usb_printer);
485 // disk image plugins
486 PLUGIN_ENTRY_FOR_IMG_MODULE(vmware3);
487 PLUGIN_ENTRY_FOR_IMG_MODULE(vmware4);
488 PLUGIN_ENTRY_FOR_IMG_MODULE(vbox);
489 PLUGIN_ENTRY_FOR_IMG_MODULE(vpc);
490 PLUGIN_ENTRY_FOR_IMG_MODULE(vvfat);
491 
492 #endif
493 
494 #ifdef __cplusplus
495 }
496 #endif
497 
498 #endif /* __PLUGIN_H */
499