2003-01-06 05:20:47 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2003-01-06 05:20:47 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-01-28 12:52:09 +03:00
|
|
|
// Copyright (C) 2002-2017 The Bochs Project
|
2003-01-06 05:20:47 +03:00
|
|
|
//
|
|
|
|
// 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
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2003-01-06 05:20:47 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// External circuit for MSDOS compatible FPU exceptions
|
|
|
|
//
|
|
|
|
|
|
|
|
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
2008-01-27 01:24:03 +03:00
|
|
|
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
2003-01-06 05:20:47 +03:00
|
|
|
// is used to know when we are exporting symbols and when we are importing.
|
|
|
|
#define BX_PLUGGABLE
|
|
|
|
|
2004-06-19 19:20:15 +04:00
|
|
|
#include "iodev.h"
|
2008-12-29 23:16:08 +03:00
|
|
|
#include "extfpuirq.h"
|
2003-01-06 05:20:47 +03:00
|
|
|
|
|
|
|
#define LOG_THIS theExternalFpuIrq->
|
|
|
|
|
|
|
|
bx_extfpuirq_c *theExternalFpuIrq = NULL;
|
|
|
|
|
2017-01-28 12:52:09 +03:00
|
|
|
int CDECL libextfpuirq_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
|
2003-01-06 05:20:47 +03:00
|
|
|
{
|
2006-09-10 21:18:44 +04:00
|
|
|
theExternalFpuIrq = new bx_extfpuirq_c();
|
2003-01-09 20:14:20 +03:00
|
|
|
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theExternalFpuIrq, BX_PLUGIN_EXTFPUIRQ);
|
2003-01-06 05:20:47 +03:00
|
|
|
return(0); // Success
|
|
|
|
}
|
|
|
|
|
2014-06-08 12:40:08 +04:00
|
|
|
void CDECL libextfpuirq_LTX_plugin_fini(void)
|
2003-01-06 05:20:47 +03:00
|
|
|
{
|
2006-09-10 21:18:44 +04:00
|
|
|
delete theExternalFpuIrq;
|
2003-01-06 05:20:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bx_extfpuirq_c::bx_extfpuirq_c(void)
|
|
|
|
{
|
2013-12-29 16:56:52 +04:00
|
|
|
put("extfpuirq", "EXFIRQ");
|
2003-01-06 05:20:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bx_extfpuirq_c::~bx_extfpuirq_c(void)
|
|
|
|
{
|
2006-09-10 21:18:44 +04:00
|
|
|
BX_DEBUG(("Exit"));
|
2003-01-06 05:20:47 +03:00
|
|
|
}
|
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
void bx_extfpuirq_c::init(void)
|
2003-01-06 05:20:47 +03:00
|
|
|
{
|
|
|
|
// called once when bochs initializes
|
2003-07-31 16:04:48 +04:00
|
|
|
DEV_register_iowrite_handler(this, write_handler, 0x00F0, "External FPU IRQ", 1);
|
2003-01-06 05:20:47 +03:00
|
|
|
DEV_register_irq(13, "External FPU IRQ");
|
|
|
|
}
|
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
void bx_extfpuirq_c::reset(unsigned type)
|
2003-01-06 05:20:47 +03:00
|
|
|
{
|
|
|
|
// We should handle IGNNE here
|
|
|
|
DEV_pic_lower_irq(13);
|
|
|
|
}
|
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
// static IO port write callback handler
|
|
|
|
// redirects to non-static class handler to avoid virtual functions
|
2003-01-06 05:20:47 +03:00
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
void bx_extfpuirq_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
2003-01-06 05:20:47 +03:00
|
|
|
{
|
|
|
|
#if !BX_USE_EFI_SMF
|
|
|
|
bx_extfpuirq_c *class_ptr = (bx_extfpuirq_c *) this_ptr;
|
|
|
|
class_ptr->write(address, value, io_len);
|
|
|
|
}
|
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
void bx_extfpuirq_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
2003-01-06 05:20:47 +03:00
|
|
|
{
|
|
|
|
#else
|
|
|
|
UNUSED(this_ptr);
|
|
|
|
#endif // !BX_USE_EFI_SMF
|
|
|
|
|
|
|
|
// We should handle IGNNE here
|
|
|
|
DEV_pic_lower_irq(13);
|
|
|
|
}
|