Rewrite of the hdimage plugin code.
- Common hdimage code, lowlevel cdrom code and the classes for the Bochs "own" image modes (e.g. flat, sparse, growing") are now a part of the Bochs core. - All classes for image modes present in separate files are now built as plugins with the same self register mechanism as network, sound and usb modules. Defined new plugin type PLUGTYPE_HDIMAGE. - Temporarily disabled the base image format detection of the undoable/volatile modes for the "external" modes in the plugins case. - TODO: Bochs should know about all of the available plugins and their capabilities right after startup, but before the configuration stage.
This commit is contained in:
parent
d1d65ce49f
commit
b880fb2975
8
bochs/configure
vendored
8
bochs/configure
vendored
@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.in Id: configure.in 13935 2020-09-03 15:19:37Z vruppert .
|
||||
# From configure.in Id: configure.in 14010 2020-11-25 07:56:32Z vruppert .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69.
|
||||
#
|
||||
@ -859,8 +859,8 @@ INLINE_VAR
|
||||
NONINLINE_VAR
|
||||
EXTRA_BX_OBJS
|
||||
IODEV_LIB_VAR
|
||||
DISPLAY_LIB_VAR
|
||||
HDIMAGE_LIB_VAR
|
||||
DISPLAY_LIB_VAR
|
||||
CLEAN_DOCBOOK_VAR
|
||||
INSTALL_DOCBOOK_VAR
|
||||
BUILD_DOCBOOK_VAR
|
||||
@ -24346,11 +24346,11 @@ PRIMARY_TARGET='bochs'
|
||||
PLUGIN_LIBNAME_TRANSFORMATION='%.o=libbx_%.la'
|
||||
|
||||
if test "$bx_plugins" = 0; then
|
||||
HDIMAGE_LIB_VAR='iodev/hdimage/libhdimage.a'
|
||||
|
||||
DISPLAY_LIB_VAR='iodev/display/libdisplay.a'
|
||||
|
||||
fi
|
||||
HDIMAGE_LIB_VAR='iodev/hdimage/libhdimage.a'
|
||||
|
||||
IODEV_LIB_VAR='iodev/libiodev.a'
|
||||
NONINLINE_VAR='$(NONINLINE_OBJS)'
|
||||
|
||||
|
@ -2179,11 +2179,11 @@ PRIMARY_TARGET='bochs'
|
||||
PLUGIN_LIBNAME_TRANSFORMATION='%.o=libbx_%.la'
|
||||
|
||||
if test "$bx_plugins" = 0; then
|
||||
HDIMAGE_LIB_VAR='iodev/hdimage/libhdimage.a'
|
||||
AC_SUBST(HDIMAGE_LIB_VAR)
|
||||
DISPLAY_LIB_VAR='iodev/display/libdisplay.a'
|
||||
AC_SUBST(DISPLAY_LIB_VAR)
|
||||
fi
|
||||
HDIMAGE_LIB_VAR='iodev/hdimage/libhdimage.a'
|
||||
AC_SUBST(HDIMAGE_LIB_VAR)
|
||||
IODEV_LIB_VAR='iodev/libiodev.a'
|
||||
NONINLINE_VAR='$(NONINLINE_OBJS)'
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2017 The Bochs Project
|
||||
// Copyright (C) 2002-2020 The Bochs Project
|
||||
//
|
||||
// extplugin.h
|
||||
//
|
||||
@ -36,6 +36,7 @@ enum plugintype_t {
|
||||
PLUGTYPE_NETWORK,
|
||||
PLUGTYPE_USBDEV,
|
||||
PLUGTYPE_VGA,
|
||||
PLUGTYPE_HDIMAGE,
|
||||
PLUGTYPE_USER
|
||||
};
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "iodev/sound/soundmod.h"
|
||||
#include "iodev/network/netmod.h"
|
||||
#include "iodev/usb/usb_common.h"
|
||||
#include "iodev/hdimage/hdimage.h"
|
||||
|
||||
#define LOG_THIS bx_devices.
|
||||
|
||||
@ -181,7 +182,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
// "by hand" in this file. Basically, we're using core plugins when we
|
||||
// want to control the init order.
|
||||
//
|
||||
PLUG_load_plugin(hdimage, PLUGTYPE_CORE);
|
||||
bx_hdimage_ctl.init();
|
||||
#if BX_NETWORKING
|
||||
network_enabled = is_network_enabled();
|
||||
if (network_enabled)
|
||||
@ -462,7 +463,7 @@ void bx_devices_c::exit()
|
||||
// unload optional and user plugins first
|
||||
bx_unload_plugins();
|
||||
bx_unload_core_plugins();
|
||||
PLUG_unload_plugin(hdimage);
|
||||
bx_hdimage_ctl.exit();
|
||||
#if BX_NETWORKING
|
||||
if (network_enabled)
|
||||
bx_netmod_ctl.exit();
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2014 The Bochs Project
|
||||
# Copyright (C) 2012-2020 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
|
||||
@ -50,7 +50,7 @@ LIBTOOL=@LIBTOOL@
|
||||
WIN32_DLL_IMPORT_LIBRARY=../../@WIN32_DLL_IMPORT_LIB@
|
||||
|
||||
CDROM_OBJS = @CDROM_OBJS@
|
||||
HDIMAGE_EXTRA_OBJS = vmware3.o vmware4.o vbox.o vpc-img.o vvfat.o
|
||||
HDIMAGE_EXTRA_OBJS = vbox.o vmware3.o vmware4.o vpc-img.o vvfat.o
|
||||
|
||||
HDIMAGE_LINK_OPTS =
|
||||
HDIMAGE_LINK_OPTS_VCPP = user32.lib
|
||||
@ -58,15 +58,16 @@ HDIMAGE_LINK_OPTS_VCPP = user32.lib
|
||||
BX_INCDIRS = -I.. -I../.. -I$(srcdir)/.. -I$(srcdir)/../.. -I../../@INSTRUMENT_DIR@ -I$(srcdir)/../../@INSTRUMENT_DIR@
|
||||
LOCAL_CXXFLAGS = $(MCH_CFLAGS)
|
||||
|
||||
OBJS_THAT_CAN_BE_PLUGINS = \
|
||||
hdimage.o
|
||||
|
||||
OBJS_THAT_SUPPORT_OTHER_PLUGINS = \
|
||||
$(HDIMAGE_EXTRA_OBJS) \
|
||||
OBJS_THAT_CANNOT_BE_PLUGINS = \
|
||||
hdimage.o \
|
||||
$(CDROM_OBJS)
|
||||
|
||||
OBJS_THAT_CAN_BE_PLUGINS = \
|
||||
$(HDIMAGE_EXTRA_OBJS)
|
||||
|
||||
NONPLUGIN_OBJS = @IODEV_EXT_NON_PLUGIN_OBJS@
|
||||
PLUGIN_OBJS = @IODEV_EXT_PLUGIN_OBJS@
|
||||
HDIMAGE_DLL_TARGETS = bx_vbox.dll bx_vmware3.dll bx_vmware4.dll bx_vpc-img.dll bx_vvfat.dll
|
||||
|
||||
all: libhdimage.a
|
||||
|
||||
@ -74,7 +75,7 @@ plugins: @PLUGIN_TARGET_2@
|
||||
|
||||
plugins_gcc: $(PLUGIN_OBJS:@PLUGIN_LIBNAME_TRANSFORMATION@)
|
||||
|
||||
plugins_msvc: bx_hdimage.dll
|
||||
plugins_msvc: $(HDIMAGE_DLL_TARGETS)
|
||||
|
||||
libhdimage.a: $(NONPLUGIN_OBJS)
|
||||
@RMCOMMAND@ libhdimage.a
|
||||
@ -92,17 +93,24 @@ libhdimage.a: $(NONPLUGIN_OBJS)
|
||||
libbx_%.la: %.lo
|
||||
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH)
|
||||
|
||||
# special link rules for plugins that require more than one object file
|
||||
libbx_hdimage.la: hdimage.lo $(HDIMAGE_EXTRA_OBJS:.o=.lo) $(CDROM_OBJS:.o=.lo)
|
||||
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module hdimage.lo $(HDIMAGE_EXTRA_OBJS:.o=.lo) $(CDROM_OBJS:.o=.lo) -o libbx_hdimage.la -rpath $(PLUGIN_PATH)
|
||||
|
||||
#### building DLLs for win32 (Cygwin and MinGW/MSYS)
|
||||
bx_%.dll: %.o
|
||||
$(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
# special link rules for plugins with Cygwin, MinGW/MSYS and MSVC nmake
|
||||
bx_hdimage.dll: hdimage.o $(HDIMAGE_EXTRA_OBJS) $(CDROM_OBJS)
|
||||
@LINK_DLL@ hdimage.o $(HDIMAGE_EXTRA_OBJS) $(CDROM_OBJS) $(WIN32_DLL_IMPORT_LIBRARY) $(HDIMAGE_LINK_OPTS@LINK_VAR@)
|
||||
bx_vbox.dll: vbox.o
|
||||
@LINK_DLL@ vbox.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
bx_vmware3.dll: vmware3.o
|
||||
@LINK_DLL@ vmware3.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
bx_vmware4.dll: vmware4.o
|
||||
@LINK_DLL@ vmware4.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
bx_vpc-img.dll: vpc-img.o
|
||||
@LINK_DLL@ vpc-img.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
bx_vvfat.dll: vvfat.o
|
||||
@LINK_DLL@ vvfat.o $(WIN32_DLL_IMPORT_LIBRARY) $(HDIMAGE_LINK_OPTS@LINK_VAR@)
|
||||
|
||||
##### end DLL section
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2014 The Bochs Project
|
||||
// Copyright (C) 2002-2020 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
|
||||
@ -21,11 +21,6 @@
|
||||
|
||||
// shared code for the low-level cdrom support
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#include "bochs.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2015 The Bochs Project
|
||||
// Copyright (C) 2002-2020 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
|
||||
@ -25,11 +25,6 @@
|
||||
// ioctl() calls and such. Should be fairly easy to add support
|
||||
// for your OS if it is not supported yet.
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#include "bochs.h"
|
||||
#if BX_SUPPORT_CDROM
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
// Copyright (C) 2002-2020 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
|
||||
@ -25,11 +25,6 @@
|
||||
// ioctl() calls and such. Should be fairly easy to add support
|
||||
// for your OS if it is not supported yet.
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#include "bochs.h"
|
||||
#if BX_SUPPORT_CDROM
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2019 The Bochs Project
|
||||
// Copyright (C) 2002-2020 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
|
||||
@ -25,11 +25,6 @@
|
||||
// ioctl() calls and such. Should be fairly easy to add support
|
||||
// for your OS if it is not supported yet.
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#include "bochs.h"
|
||||
#if BX_SUPPORT_CDROM
|
||||
|
||||
|
@ -19,11 +19,6 @@
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#ifdef BXIMAGE
|
||||
#include "config.h"
|
||||
#include "misc/bxcompat.h"
|
||||
@ -38,11 +33,13 @@
|
||||
#include "cdrom_win32.h"
|
||||
#endif
|
||||
#include "hdimage.h"
|
||||
#if !BX_PLUGINS || defined(BXIMAGE)
|
||||
#include "vbox.h"
|
||||
#include "vmware3.h"
|
||||
#include "vmware4.h"
|
||||
#include "vvfat.h"
|
||||
#include "vpc-img.h"
|
||||
#include "vbox.h"
|
||||
#include "vvfat.h"
|
||||
#endif
|
||||
|
||||
#if BX_HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
@ -57,33 +54,38 @@
|
||||
#define O_ACCMODE (O_WRONLY | O_RDWR)
|
||||
#endif
|
||||
|
||||
#define LOG_THIS theHDImageCtl->
|
||||
#define LOG_THIS bx_hdimage_ctl.
|
||||
|
||||
#ifndef BXIMAGE
|
||||
|
||||
bx_hdimage_ctl_c* theHDImageCtl = NULL;
|
||||
|
||||
int CDECL libhdimage_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
|
||||
{
|
||||
if (type == PLUGTYPE_CORE) {
|
||||
theHDImageCtl = new bx_hdimage_ctl_c;
|
||||
bx_devices.pluginHDImageCtl = theHDImageCtl;
|
||||
return 0; // Success
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void CDECL libhdimage_LTX_plugin_fini(void)
|
||||
{
|
||||
delete theHDImageCtl;
|
||||
}
|
||||
bx_hdimage_ctl_c bx_hdimage_ctl;
|
||||
|
||||
bx_hdimage_ctl_c::bx_hdimage_ctl_c()
|
||||
{
|
||||
put("hdimage", "IMG");
|
||||
}
|
||||
|
||||
void bx_hdimage_ctl_c::init(void)
|
||||
{
|
||||
#if !BX_PLUGINS
|
||||
BX_INFO(("Disk image modules:"));
|
||||
BX_INFO((" flat"));
|
||||
BX_INFO((" concat"));
|
||||
BX_INFO((" sparse"));
|
||||
BX_INFO((" growing"));
|
||||
BX_INFO((" undoable"));
|
||||
BX_INFO((" volatile"));
|
||||
hdimage_locator_c::print_modules();
|
||||
#else
|
||||
// TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
void bx_hdimage_ctl_c::exit(void)
|
||||
{
|
||||
hdimage_locator_c::cleanup();
|
||||
}
|
||||
|
||||
device_image_t* bx_hdimage_ctl_c::init_image(Bit8u image_mode, Bit64u disk_size, const char *journal)
|
||||
{
|
||||
device_image_t *hdimage = NULL;
|
||||
@ -115,14 +117,6 @@ device_image_t* bx_hdimage_ctl_c::init_image(Bit8u image_mode, Bit64u disk_size,
|
||||
hdimage = new sparse_image_t();
|
||||
break;
|
||||
|
||||
case BX_HDIMAGE_MODE_VMWARE3:
|
||||
hdimage = new vmware3_image_t();
|
||||
break;
|
||||
|
||||
case BX_HDIMAGE_MODE_VMWARE4:
|
||||
hdimage = new vmware4_image_t();
|
||||
break;
|
||||
|
||||
case BX_HDIMAGE_MODE_UNDOABLE:
|
||||
hdimage = new undoable_image_t(journal);
|
||||
break;
|
||||
@ -135,21 +129,15 @@ device_image_t* bx_hdimage_ctl_c::init_image(Bit8u image_mode, Bit64u disk_size,
|
||||
hdimage = new volatile_image_t(journal);
|
||||
break;
|
||||
|
||||
case BX_HDIMAGE_MODE_VVFAT:
|
||||
hdimage = new vvfat_image_t(disk_size, journal);
|
||||
break;
|
||||
|
||||
case BX_HDIMAGE_MODE_VPC:
|
||||
hdimage = new vpc_image_t();
|
||||
break;
|
||||
|
||||
case BX_HDIMAGE_MODE_VBOX:
|
||||
hdimage = new vbox_image_t();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!hdimage_locator_c::module_present(hdimage_mode_names[image_mode])) {
|
||||
#if BX_PLUGINS
|
||||
PLUG_load_img_plugin(hdimage_mode_names[image_mode]);
|
||||
#else
|
||||
BX_PANIC(("Disk image mode '%s' not available", hdimage_mode_names[image_mode]));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
hdimage = hdimage_locator_c::create(hdimage_mode_names[image_mode], disk_size, journal);
|
||||
}
|
||||
return hdimage;
|
||||
}
|
||||
@ -163,6 +151,85 @@ cdrom_base_c* bx_hdimage_ctl_c::init_cdrom(const char *dev)
|
||||
#endif
|
||||
}
|
||||
|
||||
hdimage_locator_c *hdimage_locator_c::all;
|
||||
|
||||
//
|
||||
// Each disk image module has a static locator class that registers
|
||||
// here
|
||||
//
|
||||
hdimage_locator_c::hdimage_locator_c(const char *mode)
|
||||
{
|
||||
next = all;
|
||||
all = this;
|
||||
this->mode = mode;
|
||||
}
|
||||
|
||||
hdimage_locator_c::~hdimage_locator_c()
|
||||
{
|
||||
hdimage_locator_c *ptr = 0;
|
||||
|
||||
if (this == all) {
|
||||
all = all->next;
|
||||
} else {
|
||||
ptr = all;
|
||||
while (ptr != NULL) {
|
||||
if (ptr->next != this) {
|
||||
ptr = ptr->next;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptr) {
|
||||
ptr->next = this->next;
|
||||
}
|
||||
}
|
||||
|
||||
void hdimage_locator_c::print_modules()
|
||||
{
|
||||
hdimage_locator_c *ptr = 0;
|
||||
|
||||
for (ptr = all; ptr != NULL; ptr = ptr->next) {
|
||||
BX_INFO((" %s", ptr->mode);)
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool hdimage_locator_c::module_present(const char *mode)
|
||||
{
|
||||
hdimage_locator_c *ptr = 0;
|
||||
|
||||
for (ptr = all; ptr != NULL; ptr = ptr->next) {
|
||||
if (strcmp(mode, ptr->mode) == 0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hdimage_locator_c::cleanup()
|
||||
{
|
||||
#if BX_PLUGINS
|
||||
while (all != NULL) {
|
||||
PLUG_unload_img_plugin(all->mode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Called by common hdimage code to locate and create a device_image_t
|
||||
// object
|
||||
//
|
||||
device_image_t*
|
||||
hdimage_locator_c::create(const char *mode, Bit64u disk_size, const char *journal)
|
||||
{
|
||||
hdimage_locator_c *ptr = 0;
|
||||
|
||||
for (ptr = all; ptr != NULL; ptr = ptr->next) {
|
||||
if (strcmp(mode, ptr->mode) == 0)
|
||||
return (ptr->allocate(disk_size, journal));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // ifndef BXIMAGE
|
||||
|
||||
// helper functions
|
||||
@ -304,16 +371,18 @@ int hdimage_detect_image_mode(const char *pathname)
|
||||
|
||||
if (sparse_image_t::check_format(fd, image_size) == HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_SPARSE;
|
||||
} else if (growing_image_t::check_format(fd, image_size) == HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_GROWING;
|
||||
#if !BX_PLUGINS || defined(BXIMAGE)
|
||||
} else if (vbox_image_t::check_format(fd, image_size) >= HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_VBOX;
|
||||
} else if (vmware3_image_t::check_format(fd, image_size) == HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_VMWARE3;
|
||||
} else if (vmware4_image_t::check_format(fd, image_size) == HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_VMWARE4;
|
||||
} else if (growing_image_t::check_format(fd, image_size) == HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_GROWING;
|
||||
} else if (vpc_image_t::check_format(fd, image_size) >= HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_VPC;
|
||||
} else if (vbox_image_t::check_format(fd, image_size) >= HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_VBOX;
|
||||
#endif
|
||||
} else if (flat_image_t::check_format(fd, image_size) == HDIMAGE_FORMAT_OK) {
|
||||
result = BX_HDIMAGE_MODE_FLAT;
|
||||
}
|
||||
|
@ -141,26 +141,26 @@
|
||||
class device_image_t;
|
||||
class redolog_t;
|
||||
|
||||
int bx_read_image(int fd, Bit64s offset, void *buf, int count);
|
||||
int bx_write_image(int fd, Bit64s offset, void *buf, int count);
|
||||
int bx_close_image(int fd, const char *pathname);
|
||||
BOCHSAPI_MSVCONLY int bx_read_image(int fd, Bit64s offset, void *buf, int count);
|
||||
BOCHSAPI_MSVCONLY int bx_write_image(int fd, Bit64s offset, void *buf, int count);
|
||||
BOCHSAPI_MSVCONLY int bx_close_image(int fd, const char *pathname);
|
||||
#ifndef WIN32
|
||||
int hdimage_open_file(const char *pathname, int flags, Bit64u *fsize, time_t *mtime);
|
||||
#else
|
||||
int hdimage_open_file(const char *pathname, int flags, Bit64u *fsize, FILETIME *mtime);
|
||||
BOCHSAPI_MSVCONLY int hdimage_open_file(const char *pathname, int flags, Bit64u *fsize, FILETIME *mtime);
|
||||
#endif
|
||||
int hdimage_detect_image_mode(const char *pathname);
|
||||
bx_bool hdimage_backup_file(int fd, const char *backup_fname);
|
||||
bx_bool hdimage_copy_file(const char *src, const char *dst);
|
||||
BOCHSAPI_MSVCONLY bx_bool hdimage_backup_file(int fd, const char *backup_fname);
|
||||
BOCHSAPI_MSVCONLY bx_bool hdimage_copy_file(const char *src, const char *dst);
|
||||
bx_bool coherency_check(device_image_t *ro_disk, redolog_t *redolog);
|
||||
#ifndef WIN32
|
||||
Bit16u fat_datetime(time_t time, int return_time);
|
||||
#else
|
||||
Bit16u fat_datetime(FILETIME time, int return_time);
|
||||
Bit16u BOCHSAPI_MSVCONLY fat_datetime(FILETIME time, int return_time);
|
||||
#endif
|
||||
|
||||
// base class
|
||||
class device_image_t
|
||||
class BOCHSAPI_MSVCONLY device_image_t
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
@ -426,7 +426,7 @@ class dll_image_t : public device_image_t
|
||||
#endif
|
||||
|
||||
// REDOLOG class
|
||||
class redolog_t
|
||||
class BOCHSAPI_MSVCONLY redolog_t
|
||||
{
|
||||
public:
|
||||
redolog_t();
|
||||
@ -601,13 +601,43 @@ class volatile_image_t : public device_image_t
|
||||
|
||||
|
||||
#ifndef BXIMAGE
|
||||
class bx_hdimage_ctl_c : public bx_hdimage_ctl_stub_c {
|
||||
|
||||
#define DEV_hdimage_init_image(a,b,c) bx_hdimage_ctl.init_image(a,b,c)
|
||||
#define DEV_hdimage_init_cdrom(a) bx_hdimage_ctl.init_cdrom(a)
|
||||
|
||||
class BOCHSAPI bx_hdimage_ctl_c : public logfunctions {
|
||||
public:
|
||||
bx_hdimage_ctl_c();
|
||||
virtual ~bx_hdimage_ctl_c() {}
|
||||
virtual device_image_t *init_image(Bit8u image_mode, Bit64u disk_size, const char *journal);
|
||||
virtual cdrom_base_c *init_cdrom(const char *dev);
|
||||
void init(void);
|
||||
void exit(void);
|
||||
device_image_t *init_image(Bit8u image_mode, Bit64u disk_size, const char *journal);
|
||||
cdrom_base_c *init_cdrom(const char *dev);
|
||||
};
|
||||
|
||||
BOCHSAPI extern bx_hdimage_ctl_c bx_hdimage_ctl;
|
||||
|
||||
//
|
||||
// The hdimage_locator class is used by device_image_t classes to register
|
||||
// their name. The common hdimage code uses the static 'create' method
|
||||
// to locate and instantiate a device_image_t class.
|
||||
//
|
||||
class BOCHSAPI_MSVCONLY hdimage_locator_c {
|
||||
public:
|
||||
static bx_bool module_present(const char *mode);
|
||||
static void print_modules();
|
||||
static void cleanup();
|
||||
static device_image_t *create(const char *mode, Bit64u disk_size, const char *journal);
|
||||
protected:
|
||||
hdimage_locator_c(const char *mode);
|
||||
virtual ~hdimage_locator_c();
|
||||
virtual device_image_t *allocate(Bit64u disk_size, const char *journal) = 0;
|
||||
private:
|
||||
static hdimage_locator_c *all;
|
||||
hdimage_locator_c *next;
|
||||
const char *mode;
|
||||
};
|
||||
|
||||
#endif // BXIMAGE
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Contact: fys [at] fysnet [dot] net
|
||||
*
|
||||
* Copyright (C) 2015 Benjamin D Lunt.
|
||||
* Copyright (C) 2006-2018 The Bochs Project
|
||||
* Copyright (C) 2006-2020 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
|
||||
@ -50,11 +50,40 @@
|
||||
#include "hdimage.h"
|
||||
#include "vbox.h"
|
||||
|
||||
#define LOG_THIS bx_devices.pluginHDImageCtl->
|
||||
#define LOG_THIS bx_hdimage_ctl.
|
||||
|
||||
const off_t vbox_image_t::INVALID_OFFSET = (off_t)-1;
|
||||
const int vbox_image_t::SECTOR_SIZE = 512;
|
||||
|
||||
#ifndef BXIMAGE
|
||||
|
||||
// disk image plugin entry points
|
||||
|
||||
int CDECL libvbox_img_plugin_init(plugin_t *plugin, plugintype_t type)
|
||||
{
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void CDECL libvbox_img_plugin_fini(void)
|
||||
{
|
||||
// Nothing here yet
|
||||
}
|
||||
|
||||
//
|
||||
// Define the static class that registers the derived device image class,
|
||||
// and allocates one on request.
|
||||
//
|
||||
class bx_vbox_locator_c : public hdimage_locator_c {
|
||||
public:
|
||||
bx_vbox_locator_c(void) : hdimage_locator_c("vbox") {}
|
||||
protected:
|
||||
device_image_t *allocate(Bit64u disk_size, const char *journal) {
|
||||
return (new vbox_image_t());
|
||||
}
|
||||
} bx_vbox_match;
|
||||
|
||||
#endif
|
||||
|
||||
vbox_image_t::vbox_image_t()
|
||||
: file_descriptor(-1),
|
||||
mtlb(0),
|
||||
|
@ -45,11 +45,40 @@
|
||||
|
||||
const off_t vmware3_image_t::INVALID_OFFSET=(off_t)-1;
|
||||
|
||||
#define LOG_THIS bx_devices.pluginHDImageCtl->
|
||||
#define LOG_THIS bx_hdimage_ctl.
|
||||
|
||||
#define DTOH32_HEADER(field) (header.field = (dtoh32(header.field)))
|
||||
#define HTOD32_HEADER(field) (header.field = (htod32(header.field)))
|
||||
|
||||
#ifndef BXIMAGE
|
||||
|
||||
// disk image plugin entry points
|
||||
|
||||
int CDECL libvmware3_img_plugin_init(plugin_t *plugin, plugintype_t type)
|
||||
{
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void CDECL libvmware3_img_plugin_fini(void)
|
||||
{
|
||||
// Nothing here yet
|
||||
}
|
||||
|
||||
//
|
||||
// Define the static class that registers the derived device image class,
|
||||
// and allocates one on request.
|
||||
//
|
||||
class bx_vmware3_locator_c : public hdimage_locator_c {
|
||||
public:
|
||||
bx_vmware3_locator_c(void) : hdimage_locator_c("vmware3") {}
|
||||
protected:
|
||||
device_image_t *allocate(Bit64u disk_size, const char *journal) {
|
||||
return (new vmware3_image_t());
|
||||
}
|
||||
} bx_vmware3_match;
|
||||
|
||||
#endif
|
||||
|
||||
int vmware3_image_t::check_format(int fd, Bit64u imgsize)
|
||||
{
|
||||
COW_Header header;
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Contact: snrrrub@gmail.com
|
||||
*
|
||||
* Copyright (C) 2006 Sharvil Nanavati.
|
||||
* Copyright (C) 2006-2018 The Bochs Project
|
||||
* Copyright (C) 2006-2020 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
|
||||
@ -43,11 +43,40 @@
|
||||
#include "hdimage.h"
|
||||
#include "vmware4.h"
|
||||
|
||||
#define LOG_THIS bx_devices.pluginHDImageCtl->
|
||||
#define LOG_THIS bx_hdimage_ctl.
|
||||
|
||||
const off_t vmware4_image_t::INVALID_OFFSET = (off_t)-1;
|
||||
const int vmware4_image_t::SECTOR_SIZE = 512;
|
||||
|
||||
#ifndef BXIMAGE
|
||||
|
||||
// disk image plugin entry points
|
||||
|
||||
int CDECL libvmware4_img_plugin_init(plugin_t *plugin, plugintype_t type)
|
||||
{
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void CDECL libvmware4_img_plugin_fini(void)
|
||||
{
|
||||
// Nothing here yet
|
||||
}
|
||||
|
||||
//
|
||||
// Define the static class that registers the derived device image class,
|
||||
// and allocates one on request.
|
||||
//
|
||||
class bx_vmware4_locator_c : public hdimage_locator_c {
|
||||
public:
|
||||
bx_vmware4_locator_c(void) : hdimage_locator_c("vmware4") {}
|
||||
protected:
|
||||
device_image_t *allocate(Bit64u disk_size, const char *journal) {
|
||||
return (new vmware4_image_t());
|
||||
}
|
||||
} bx_vmware4_match;
|
||||
|
||||
#endif
|
||||
|
||||
vmware4_image_t::vmware4_image_t()
|
||||
: file_descriptor(-1),
|
||||
tlb(0),
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Copyright (c) 2005 Alex Beregszaszi
|
||||
// Copyright (c) 2009 Kevin Wolf <kwolf@suse.de>
|
||||
// Copyright (C) 2012-2018 The Bochs Project
|
||||
// Copyright (C) 2012-2020 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
|
||||
@ -44,7 +44,36 @@
|
||||
#include "hdimage.h"
|
||||
#include "vpc-img.h"
|
||||
|
||||
#define LOG_THIS bx_devices.pluginHDImageCtl->
|
||||
#define LOG_THIS bx_hdimage_ctl.
|
||||
|
||||
#ifndef BXIMAGE
|
||||
|
||||
// disk image plugin entry points
|
||||
|
||||
int CDECL libvpc_img_plugin_init(plugin_t *plugin, plugintype_t type)
|
||||
{
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void CDECL libvpc_img_plugin_fini(void)
|
||||
{
|
||||
// Nothing here yet
|
||||
}
|
||||
|
||||
//
|
||||
// Define the static class that registers the derived device image class,
|
||||
// and allocates one on request.
|
||||
//
|
||||
class bx_vpc_locator_c : public hdimage_locator_c {
|
||||
public:
|
||||
bx_vpc_locator_c(void) : hdimage_locator_c("vpc") {}
|
||||
protected:
|
||||
device_image_t *allocate(Bit64u disk_size, const char *journal) {
|
||||
return (new vpc_image_t());
|
||||
}
|
||||
} bx_vpc_match;
|
||||
|
||||
#endif
|
||||
|
||||
Bit32u vpc_checksum(Bit8u *buf, size_t size)
|
||||
{
|
||||
|
@ -53,12 +53,38 @@
|
||||
#include "hdimage.h"
|
||||
#include "vvfat.h"
|
||||
|
||||
#define LOG_THIS bx_devices.pluginHDImageCtl->
|
||||
#define LOG_THIS bx_hdimage_ctl.
|
||||
|
||||
#define VVFAT_MBR "vvfat_mbr.bin"
|
||||
#define VVFAT_BOOT "vvfat_boot.bin"
|
||||
#define VVFAT_ATTR "vvfat_attr.cfg"
|
||||
|
||||
// disk image plugin entry points
|
||||
|
||||
int CDECL libvvfat_img_plugin_init(plugin_t *plugin, plugintype_t type)
|
||||
{
|
||||
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.
|
||||
//
|
||||
class bx_vvfat_locator_c : public hdimage_locator_c {
|
||||
public:
|
||||
bx_vvfat_locator_c(void) : hdimage_locator_c("vvfat") {}
|
||||
protected:
|
||||
device_image_t *allocate(Bit64u disk_size, const char *journal) {
|
||||
return (new vvfat_image_t(disk_size, journal));
|
||||
}
|
||||
} bx_vvfat_match;
|
||||
|
||||
|
||||
static int vvfat_count = 0;
|
||||
|
||||
// portable mkdir / rmdir
|
||||
|
@ -363,16 +363,6 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
class BOCHSAPI bx_hdimage_ctl_stub_c : public bx_devmodel_c {
|
||||
public:
|
||||
virtual device_image_t* init_image(Bit8u image_mode, Bit64u disk_size, const char *journal) {
|
||||
STUBFUNC(hdimage_ctl, init_image); return NULL;
|
||||
}
|
||||
virtual cdrom_base_c* init_cdrom(const char *dev) {
|
||||
STUBFUNC(hdimage_ctl, init_cdrom); return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
class BOCHSAPI bx_devices_c : public logfunctions {
|
||||
public:
|
||||
bx_devices_c();
|
||||
@ -453,7 +443,6 @@ public:
|
||||
bx_cmos_stub_c *pluginCmosDevice;
|
||||
bx_dma_stub_c *pluginDmaDevice;
|
||||
bx_hard_drive_stub_c *pluginHardDrive;
|
||||
bx_hdimage_ctl_stub_c *pluginHDImageCtl;
|
||||
bx_pic_stub_c *pluginPicDevice;
|
||||
bx_pit_stub_c *pluginPitDevice;
|
||||
bx_speaker_stub_c *pluginSpeaker;
|
||||
@ -478,7 +467,6 @@ public:
|
||||
bx_cmos_stub_c stubCmos;
|
||||
bx_dma_stub_c stubDma;
|
||||
bx_hard_drive_stub_c stubHardDrive;
|
||||
bx_hdimage_ctl_stub_c stubHDImage;
|
||||
bx_pic_stub_c stubPic;
|
||||
bx_pit_stub_c stubPit;
|
||||
bx_speaker_stub_c stubSpeaker;
|
||||
|
@ -46,18 +46,18 @@
|
||||
#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_PATH ""
|
||||
|
||||
#ifndef WIN32
|
||||
#define PLUGIN_FILENAME_FORMAT "libbx_%s.so"
|
||||
#define SOUND_PLUGIN_FILENAME_FORMAT "libbx_sound%s.so"
|
||||
#define NET_PLUGIN_FILENAME_FORMAT "libbx_eth_%s.so"
|
||||
#define USB_PLUGIN_FILENAME_FORMAT "libbx_%s.so"
|
||||
#else
|
||||
#define PLUGIN_FILENAME_FORMAT "bx_%s.dll"
|
||||
#define SOUND_PLUGIN_FILENAME_FORMAT "bx_sound%s.dll"
|
||||
#define NET_PLUGIN_FILENAME_FORMAT "bx_eth_%s.dll"
|
||||
#define USB_PLUGIN_FILENAME_FORMAT "bx_%s.dll"
|
||||
#endif
|
||||
|
||||
logfunctions *pluginlog;
|
||||
@ -325,8 +325,9 @@ void plugin_load(char *name, plugintype_t type)
|
||||
sprintf(tmpname, SOUND_PLUGIN_FILENAME_FORMAT, name);
|
||||
} else if (type == PLUGTYPE_NETWORK) {
|
||||
sprintf(tmpname, NET_PLUGIN_FILENAME_FORMAT, name);
|
||||
} else if (type == PLUGTYPE_USBDEV) {
|
||||
sprintf(tmpname, USB_PLUGIN_FILENAME_FORMAT, name);
|
||||
} else if ((type == PLUGTYPE_HDIMAGE) && !strcmp(name, "vpc")) {
|
||||
// FIXME: HACK!!!
|
||||
sprintf(tmpname, PLUGIN_FILENAME_FORMAT, "vpc-img");
|
||||
} else {
|
||||
sprintf(tmpname, PLUGIN_FILENAME_FORMAT, name);
|
||||
}
|
||||
@ -378,6 +379,8 @@ void plugin_load(char *name, plugintype_t type)
|
||||
sprintf(tmpname, NET_PLUGIN_INIT_FMT_STRING, name);
|
||||
} else if (type == PLUGTYPE_USBDEV) {
|
||||
sprintf(tmpname, USB_PLUGIN_INIT_FMT_STRING, name);
|
||||
} else if (type == PLUGTYPE_HDIMAGE) {
|
||||
sprintf(tmpname, IMG_PLUGIN_INIT_FMT_STRING, name);
|
||||
} else if (type != PLUGTYPE_USER) {
|
||||
sprintf(tmpname, PLUGIN_INIT_FMT_STRING, name);
|
||||
} else {
|
||||
@ -405,6 +408,8 @@ void plugin_load(char *name, plugintype_t type)
|
||||
sprintf(tmpname, NET_PLUGIN_FINI_FMT_STRING, name);
|
||||
} else if (type == PLUGTYPE_USBDEV) {
|
||||
sprintf(tmpname, USB_PLUGIN_FINI_FMT_STRING, name);
|
||||
} else if (type == PLUGTYPE_HDIMAGE) {
|
||||
sprintf(tmpname, IMG_PLUGIN_FINI_FMT_STRING, name);
|
||||
} else if (type != PLUGTYPE_USER) {
|
||||
sprintf(tmpname, PLUGIN_FINI_FMT_STRING, name);
|
||||
} else {
|
||||
@ -799,6 +804,7 @@ typedef struct {
|
||||
#define BUILTIN_NET_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_NETWORK, lib##mod##_net_plugin_init, lib##mod##_net_plugin_fini, 0}
|
||||
#define BUILTIN_USB_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_USBDEV, 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_HDIMAGE, lib##mod##_img_plugin_init, lib##mod##_img_plugin_fini, 0}
|
||||
|
||||
static builtin_plugin_t builtin_plugins[] = {
|
||||
#if BX_WITH_AMIGAOS
|
||||
@ -940,6 +946,11 @@ static builtin_plugin_t builtin_plugins[] = {
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_msd),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_printer),
|
||||
#endif
|
||||
BUILTIN_IMG_PLUGIN_ENTRY(vmware3),
|
||||
BUILTIN_IMG_PLUGIN_ENTRY(vmware4),
|
||||
BUILTIN_IMG_PLUGIN_ENTRY(vbox),
|
||||
BUILTIN_IMG_PLUGIN_ENTRY(vpc),
|
||||
BUILTIN_IMG_PLUGIN_ENTRY(vvfat),
|
||||
{"NULL", PLUGTYPE_GUI, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,6 @@ extern "C" {
|
||||
#define BX_PLUGIN_KEYBOARD "keyboard"
|
||||
#define BX_PLUGIN_BUSMOUSE "busmouse"
|
||||
#define BX_PLUGIN_HARDDRV "harddrv"
|
||||
#define BX_PLUGIN_HDIMAGE "hdimage"
|
||||
#define BX_PLUGIN_DMA "dma"
|
||||
#define BX_PLUGIN_PIC "pic"
|
||||
#define BX_PLUGIN_PIT "pit"
|
||||
@ -90,12 +89,14 @@ extern "C" {
|
||||
#define PLUG_load_net_plugin(name) bx_load_plugin(name,PLUGTYPE_NETWORK)
|
||||
#define PLUG_load_usb_plugin(name) bx_load_plugin(name,PLUGTYPE_USBDEV)
|
||||
#define PLUG_load_vga_plugin(name) bx_load_plugin(name,PLUGTYPE_VGA)
|
||||
#define PLUG_load_img_plugin(name) bx_load_plugin(name,PLUGTYPE_HDIMAGE)
|
||||
#define PLUG_load_user_plugin(name) {bx_load_plugin(name,PLUGTYPE_USER);}
|
||||
#define PLUG_unload_plugin(name) {bx_unload_plugin(#name,1);}
|
||||
#define PLUG_unload_opt_plugin(name) bx_unload_plugin(name,1)
|
||||
#define PLUG_unload_snd_plugin(name) bx_unload_plugin(name,0)
|
||||
#define PLUG_unload_net_plugin(name) bx_unload_plugin(name,0)
|
||||
#define PLUG_unload_usb_plugin(name) bx_unload_plugin(name,0)
|
||||
#define PLUG_unload_img_plugin(name) bx_unload_plugin(name,0)
|
||||
#define PLUG_unload_user_plugin(name) {bx_unload_plugin(name,1);}
|
||||
|
||||
#define DEV_register_ioread_handler(b,c,d,e,f) pluginRegisterIOReadHandler(b,c,d,e,f)
|
||||
@ -123,6 +124,7 @@ extern "C" {
|
||||
#define PLUG_load_net_plugin(name) bx_load_plugin2(name,PLUGTYPE_NETWORK)
|
||||
#define PLUG_load_usb_plugin(name) bx_load_plugin2(name,PLUGTYPE_USBDEV)
|
||||
#define PLUG_load_vga_plugin(name) bx_load_plugin2(name,PLUGTYPE_VGA)
|
||||
#define PLUG_load_img_plugin(name) bx_load_plugin2(name,PLUGTYPE_HDIMAGE)
|
||||
#define PLUG_unload_plugin(name) {lib##name##_LTX_plugin_fini();}
|
||||
#define PLUG_unload_opt_plugin(name) bx_unload_opt_plugin(name,1);
|
||||
|
||||
@ -188,8 +190,6 @@ extern "C" {
|
||||
#define DEV_hd_bmdma_read_sector(a,b,c) bx_devices.pluginHardDrive->bmdma_read_sector(a,b,c)
|
||||
#define DEV_hd_bmdma_write_sector(a,b) bx_devices.pluginHardDrive->bmdma_write_sector(a,b)
|
||||
#define DEV_hd_bmdma_complete(a) bx_devices.pluginHardDrive->bmdma_complete(a)
|
||||
#define DEV_hdimage_init_image(a,b,c) bx_devices.pluginHDImageCtl->init_image(a,b,c)
|
||||
#define DEV_hdimage_init_cdrom(a) bx_devices.pluginHDImageCtl->init_cdrom(a)
|
||||
|
||||
#define DEV_bulk_io_quantum_requested() (bx_devices.bulkIOQuantumsRequested)
|
||||
#define DEV_bulk_io_quantum_transferred() (bx_devices.bulkIOQuantumsTransferred)
|
||||
@ -379,6 +379,9 @@ int plugin_init(plugin_t *plugin, plugintype_t type);
|
||||
#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);
|
||||
#else
|
||||
#define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \
|
||||
int CDECL lib##mod##_LTX_plugin_init(plugin_t *plugin, plugintype_t type); \
|
||||
@ -395,11 +398,13 @@ int plugin_init(plugin_t *plugin, plugintype_t type);
|
||||
#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);
|
||||
#endif
|
||||
|
||||
// device plugins
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(harddrv)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(hdimage)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(keyboard)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(busmouse)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(serial)
|
||||
@ -474,6 +479,12 @@ 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)
|
||||
// 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)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user