- add msdos compatibility FPU exception support (irq 13). The IGNNE pin is no handled yet.

Modified Files:
 	bochs.h config.h.in plugin.h fpu/wmFPUemu_glue.cc
 	iodev/Makefile.in iodev/devices.cc iodev/iodev.h
 Added Files:
 	iodev/extfpuirq.cc iodev/extfpuirq.h
This commit is contained in:
Christophe Bothamy 2003-01-06 02:20:47 +00:00
parent 8b6b4db7cc
commit eb47a8bf01
9 changed files with 890 additions and 547 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.115 2002-12-19 06:05:18 bdenney Exp $
// $Id: bochs.h,v 1.116 2003-01-06 02:20:46 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -298,7 +298,7 @@ enum {
CPU2LOG, CPU3LOG, CPU4LOG, CPU5LOG, CPU6LOG, CPU7LOG, CPU8LOG, CPU9LOG,
CPU10LOG, CPU11LOG, CPU12LOG, CPU13LOG, CPU14LOG, CPU15LOG, CTRLLOG,
UNMAPLOG, SERRLOG, BIOSLOG, PIT81LOG, PIT82LOG, IODEBUGLOG, PCI2ISALOG,
PLUGINLOG
PLUGINLOG, EXTFPUIRQLOG
};
class BOCHSAPI iofunctions {

View File

@ -242,6 +242,7 @@
#define BX_USE_PCI_SMF 1 // PCI
#define BX_USE_P2I_SMF 1 // PCI-to-ISA bridge
#define BX_USE_NE2K_SMF 1 // NE2K
#define BX_USE_EFI_SMF 1 // External FPU IRQ
#define BX_PLUGINS 0
#define BX_HAVE_DLFCN_H 0
@ -252,7 +253,7 @@
|| !BX_USE_PAR_SMF || !BX_USE_PIC_SMF || !BX_USE_PIT_SMF \
|| !BX_USE_SER_SMF || !BX_USE_UM_SMF || !BX_USE_VGA_SMF \
|| !BX_USE_SB16_SMF || !BX_USE_DEV_SMF || !BX_USE_PCI_SMF \
|| !BX_USE_P2I_SMF || !BX_USE_NE2K_SMF)
|| !BX_USE_P2I_SMF || !BX_USE_NE2K_SMF || !BX_USE_EFI_SMF)
#error You must use SMF to have plugins
#endif

View File

@ -277,7 +277,10 @@ math_abort(struct info *info, unsigned int signal)
case SIGFPE:
if (fpu_cpu_ptr->cr0.ne == 0) {
// MSDOS compatibility external interrupt (IRQ13)
BX_PANIC (("math_abort: MSDOS compatibility not supported yet"));
BX_INFO (("math_abort: MSDOS compatibility FPU exception"));
DEV_pic_raise_irq(13);
return;
}
fpu_cpu_ptr->exception(BX_MF_EXCEPTION, 0, 0);
// execution does not reach here

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: devices.cc,v 1.47 2003-01-03 11:43:24 vruppert Exp $
// $Id: devices.cc,v 1.48 2003-01-06 02:20:47 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -66,6 +66,7 @@ bx_devices_c::bx_devices_c(void)
pluginHardDrive = &stubHardDrive;
pluginSB16Device = NULL;
pluginNE2kDevice =&stubNE2k;
pluginExtFpuIrq = NULL;
g2h = NULL;
#if BX_IODEBUG_SUPPORT
iodebug = NULL;
@ -86,7 +87,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
{
unsigned i;
BX_DEBUG(("Init $Id: devices.cc,v 1.47 2003-01-03 11:43:24 vruppert Exp $"));
BX_DEBUG(("Init $Id: devices.cc,v 1.48 2003-01-06 02:20:47 cbothamy Exp $"));
mem = newmem;
/* no read / write handlers defined */
@ -137,6 +138,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
PLUG_load_plugin(serial, PLUGTYPE_OPTIONAL);
if (is_parallel_enabled ())
PLUG_load_plugin(parallel, PLUGTYPE_OPTIONAL);
PLUG_load_plugin(extfpuirq, PLUGTYPE_OPTIONAL);
// Start with registering the default (unmapped) handler
pluginUnmapped->init ();

135
bochs/iodev/extfpuirq.cc Normal file
View File

@ -0,0 +1,135 @@
/////////////////////////////////////////////////////////////////////////
// $Id: extfpuirq.cc,v 1.1 2003-01-06 02:20:47 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
// 75002 Paris - France
// http://www.linux-mandrake.com/
// http://www.mandrakesoft.com/
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// External circuit for MSDOS compatible FPU exceptions
//
// 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"
#define LOG_THIS theExternalFpuIrq->
bx_extfpuirq_c *theExternalFpuIrq = NULL;
int
libextfpuirq_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
theExternalFpuIrq = new bx_extfpuirq_c ();
bx_devices.pluginPci2IsaBridge = theExternalFpuIrq;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theExternalFpuIrq, BX_PLUGIN_PCI2ISA);
return(0); // Success
}
void
libextfpuirq_LTX_plugin_fini(void)
{
}
bx_extfpuirq_c::bx_extfpuirq_c(void)
{
put("EFIRQ");
settype(EXTFPUIRQLOG);
}
bx_extfpuirq_c::~bx_extfpuirq_c(void)
{
// nothing for now
BX_DEBUG(("Exit."));
}
void
bx_extfpuirq_c::init(void)
{
// called once when bochs initializes
DEV_register_iowrite_handler(this, write_handler, 0x00F0, "External FPU IRQ", 7);
DEV_register_ioread_handler(this, read_handler, 0x00F0, "External FPU IRQ", 7);
DEV_register_irq(13, "External FPU IRQ");
}
void
bx_extfpuirq_c::reset(unsigned type)
{
// We should handle IGNNE here
DEV_pic_lower_irq(13);
}
// static IO port read callback handler
// redirects to non-static class handler to avoid virtual functions
Bit32u
bx_extfpuirq_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
{
#if !BX_USE_EFI_SMF
bx_extfpuirq_c *class_ptr = (bx_extfpuirq_c *) this_ptr;
return( class_ptr->read(address, io_len) );
}
Bit32u
bx_extfpuirq_c::read(Bit32u address, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_EFI_SMF
// We should handle IGNNE here
DEV_pic_lower_irq(13);
return(0x0);
}
// static IO port write callback handler
// redirects to non-static class handler to avoid virtual functions
void
bx_extfpuirq_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
{
#if !BX_USE_EFI_SMF
bx_extfpuirq_c *class_ptr = (bx_extfpuirq_c *) this_ptr;
class_ptr->write(address, value, io_len);
}
void
bx_extfpuirq_c::write(Bit32u address, Bit32u value, unsigned io_len)
{
#else
UNUSED(this_ptr);
#endif // !BX_USE_EFI_SMF
// We should handle IGNNE here
DEV_pic_lower_irq(13);
}

53
bochs/iodev/extfpuirq.h Normal file
View File

@ -0,0 +1,53 @@
/////////////////////////////////////////////////////////////////////////
// $Id: extfpuirq.h,v 1.1 2003-01-06 02:20:47 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
// 75002 Paris - France
// http://www.linux-mandrake.com/
// http://www.mandrakesoft.com/
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#if BX_USE_EFI_SMF
# define BX_EXTFPUIRQ_SMF static
# define BX_EXTFPUIRQ_THIS theExternalFpuIrq->
#else
# define BX_EXTFPUIRQ_SMF
# define BX_EXTFPUIRQ_THIS this->
#endif
class bx_extfpuirq_c : public bx_devmodel_c {
public:
bx_extfpuirq_c(void);
~bx_extfpuirq_c(void);
virtual void init(void);
virtual void reset(unsigned type);
private:
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
#if !BX_USE_EFI_SMF
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
#endif
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: iodev.h,v 1.26 2002-12-28 11:49:17 vruppert Exp $
// $Id: iodev.h,v 1.27 2003-01-06 02:20:47 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -311,6 +311,7 @@ public:
bx_devmodel_c *pluginSB16Device;
bx_ne2k_stub_c *pluginNE2kDevice;
bx_g2h_c *g2h;
bx_devmodel_c *pluginExtFpuIrq;
#if BX_IODEBUG_SUPPORT
bx_iodebug_c *iodebug;
#endif
@ -404,3 +405,4 @@ private:
#include "iodev/ne2k.h"
#include "iodev/guest2host.h"
#include "iodev/slowdown_timer.h"
#include "iodev/extfpuirq.h"

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: plugin.h,v 1.12 2002-12-28 11:49:16 vruppert Exp $
// $Id: plugin.h,v 1.13 2003-01-06 02:20:46 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// This file provides macros and types needed for plugins. It is based on
@ -21,21 +21,22 @@ BOCHSAPI extern logfunctions *pluginlog;
extern "C" {
#endif
#define BX_PLUGIN_UNMAPPED "unmapped"
#define BX_PLUGIN_BIOSDEV "biosdev"
#define BX_PLUGIN_CMOS "cmos"
#define BX_PLUGIN_VGA "vga"
#define BX_PLUGIN_FLOPPY "floppy"
#define BX_PLUGIN_PARALLEL "parallel"
#define BX_PLUGIN_SERIAL "serial"
#define BX_PLUGIN_KEYBOARD "keyboard"
#define BX_PLUGIN_HARDDRV "harddrv"
#define BX_PLUGIN_DMA "dma"
#define BX_PLUGIN_PIC "pic"
#define BX_PLUGIN_PCI "pci"
#define BX_PLUGIN_PCI2ISA "pci2isa"
#define BX_PLUGIN_SB16 "sb16"
#define BX_PLUGIN_NE2K "ne2k"
#define BX_PLUGIN_UNMAPPED "unmapped"
#define BX_PLUGIN_BIOSDEV " biosdev"
#define BX_PLUGIN_CMOS "cmos"
#define BX_PLUGIN_VGA "vga"
#define BX_PLUGIN_FLOPPY "floppy"
#define BX_PLUGIN_PARALLEL "parallel"
#define BX_PLUGIN_SERIAL "serial"
#define BX_PLUGIN_KEYBOARD "keyboard"
#define BX_PLUGIN_HARDDRV "harddrv"
#define BX_PLUGIN_DMA "dma"
#define BX_PLUGIN_PIC "pic"
#define BX_PLUGIN_PCI "pci"
#define BX_PLUGIN_PCI2ISA "pci2isa"
#define BX_PLUGIN_SB16 "sb16"
#define BX_PLUGIN_NE2K "ne2k"
#define BX_PLUGIN_EXTFPUIRQ "extfpuirq"
#define BX_REGISTER_DEVICE pluginRegisterDevice
#define BX_REGISTER_DEVICE_DEVMODEL(a,b,c,d) pluginRegisterDeviceDevmodel(a,b,c,d)
@ -300,6 +301,7 @@ DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sb16)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ne2k)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(extfpuirq)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(amigaos)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(beos)
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(carbon)