2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2008-12-30 21:11:13 +03:00
|
|
|
//
|
2009-12-04 22:50:29 +03:00
|
|
|
// Copyright (C) 2001-2009 The Bochs Project
|
2008-12-30 21:11:13 +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
|
2008-12-30 21:11:13 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// 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
|
2004-06-19 19:20:15 +04:00
|
|
|
|
|
|
|
#include "iodev.h"
|
2009-01-03 11:55:00 +03:00
|
|
|
|
2004-08-06 19:49:55 +04:00
|
|
|
#if BX_SUPPORT_IODEBUG
|
2009-01-03 11:55:00 +03:00
|
|
|
|
|
|
|
#include "cpu/cpu.h"
|
2008-12-30 21:11:13 +03:00
|
|
|
#include "iodebug.h"
|
2001-09-14 18:29:21 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
#define BX_IODEBUG_THIS this->
|
2001-09-15 04:12:40 +04:00
|
|
|
|
2008-12-30 21:11:13 +03:00
|
|
|
bx_iodebug_c *theIODebugDevice = NULL;
|
|
|
|
|
|
|
|
int libiodebug_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
|
|
|
{
|
|
|
|
theIODebugDevice = new bx_iodebug_c();
|
|
|
|
bx_devices.pluginIODebug = theIODebugDevice;
|
|
|
|
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theIODebugDevice, BX_PLUGIN_IODEBUG);
|
|
|
|
return(0); // Success
|
|
|
|
}
|
|
|
|
|
|
|
|
void libiodebug_LTX_plugin_fini(void)
|
|
|
|
{
|
|
|
|
delete theIODebugDevice;
|
|
|
|
}
|
2001-09-15 02:38:06 +04:00
|
|
|
|
2008-05-02 00:46:58 +04:00
|
|
|
struct bx_iodebug_s_type {
|
|
|
|
bx_bool enabled;
|
|
|
|
unsigned register_select;
|
|
|
|
Bit32u registers[2];
|
|
|
|
bx_phy_address monitored_mem_areas_start[BX_IODEBUG_MAX_AREAS];
|
|
|
|
bx_phy_address monitored_mem_areas_end[BX_IODEBUG_MAX_AREAS];
|
|
|
|
} bx_iodebug_s;
|
|
|
|
|
2001-09-15 02:38:06 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
bx_iodebug_c::bx_iodebug_c()
|
2001-09-14 18:29:21 +04:00
|
|
|
{
|
2006-11-01 18:44:38 +03:00
|
|
|
put("IODBG");
|
2001-09-14 18:29:21 +04:00
|
|
|
}
|
|
|
|
|
2002-10-26 07:53:22 +04:00
|
|
|
void bx_iodebug_c::init(void)
|
2001-09-14 18:29:21 +04:00
|
|
|
{
|
2006-11-01 18:44:38 +03:00
|
|
|
DEV_register_ioread_handler(this, read_handler, 0x8A00,"BOCHS IODEBUG", 2);
|
|
|
|
DEV_register_iowrite_handler(this, write_handler, 0x8A00,"BOCHS IODEBUG", 2);
|
|
|
|
DEV_register_iowrite_handler(this, write_handler, 0x8A01,"BOCHS IODEBUG", 2);
|
2001-09-14 18:29:21 +04:00
|
|
|
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.enabled = 0;
|
|
|
|
bx_iodebug_s.register_select = 0;
|
2006-03-03 15:55:37 +03:00
|
|
|
|
|
|
|
for(int i=0;i<BX_IODEBUG_MAX_AREAS;i++) {
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.monitored_mem_areas_start[i] = 0;
|
|
|
|
bx_iodebug_s.monitored_mem_areas_end[i] = 0;
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
2001-09-14 18:29:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
Bit32u bx_iodebug_c::read_handler(void *this_ptr, Bit32u addr, unsigned io_len)
|
|
|
|
{
|
2006-03-07 01:03:16 +03:00
|
|
|
bx_iodebug_c *bx_iodebug_ptr = (bx_iodebug_c *) this_ptr;
|
2006-03-03 15:55:37 +03:00
|
|
|
return bx_iodebug_ptr->read(addr, io_len);
|
2001-09-14 18:29:21 +04:00
|
|
|
}
|
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
Bit32u bx_iodebug_c::read(Bit32u addr, unsigned io_len)
|
2001-09-14 18:29:21 +04:00
|
|
|
{
|
2006-11-01 18:44:38 +03:00
|
|
|
if (bx_iodebug_s.enabled) return 0x8A00;
|
2001-09-14 20:21:02 +04:00
|
|
|
return(0);
|
2001-09-14 18:29:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void bx_iodebug_c::write_handler(void *this_ptr, Bit32u addr, Bit32u dvalue, unsigned io_len)
|
|
|
|
{
|
2006-03-07 01:03:16 +03:00
|
|
|
bx_iodebug_c *bx_iodebug_ptr = (bx_iodebug_c *) this_ptr;
|
2006-03-03 15:55:37 +03:00
|
|
|
bx_iodebug_ptr->write(addr, dvalue, io_len);
|
2001-09-14 18:29:21 +04:00
|
|
|
}
|
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
void bx_iodebug_c::write(Bit32u addr, Bit32u dvalue, unsigned io_len)
|
2001-09-14 18:29:21 +04:00
|
|
|
{
|
2008-05-02 00:46:58 +04:00
|
|
|
//fprintf(stderr, "IODEBUG addr: %4x\tdvalue: %8x\tio_len: %8x\n", (unsigned) addr, (unsigned) dvalue, io_len);
|
2001-09-14 20:21:02 +04:00
|
|
|
|
2006-11-01 18:44:38 +03:00
|
|
|
if (addr == 0x8A01)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2008-05-02 00:46:58 +04:00
|
|
|
bx_iodebug_s.registers[bx_iodebug_s.register_select] =
|
2001-09-15 02:38:06 +04:00
|
|
|
(bx_iodebug_s.registers[bx_iodebug_s.register_select] << 16) +
|
2006-03-03 15:55:37 +03:00
|
|
|
(dvalue & 0xFFFF);
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
|
|
|
|
2006-11-01 18:44:38 +03:00
|
|
|
if (addr != 0x8A00) return;
|
2001-09-14 20:21:02 +04:00
|
|
|
|
2006-11-01 18:44:38 +03:00
|
|
|
if (!bx_iodebug_s.enabled)
|
2001-09-15 02:38:06 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
if(dvalue == 0x8A00)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.enabled = 1;
|
2006-03-07 01:03:16 +03:00
|
|
|
// fprintf(stderr, "IODEBUG enabled\n");
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.registers[0] = 0;
|
|
|
|
bx_iodebug_s.registers[1] = 0;
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
2001-09-15 02:38:06 +04:00
|
|
|
return;
|
|
|
|
}
|
2001-09-14 20:21:02 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
switch(dvalue)
|
2001-09-15 02:38:06 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8A01:
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.register_select = 0;
|
2006-03-07 01:03:16 +03:00
|
|
|
// fprintf(stderr, "IODEBUG register 0 selected\n");
|
2001-09-15 02:38:06 +04:00
|
|
|
break;
|
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8A02:
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.register_select = 1;
|
2006-03-07 01:03:16 +03:00
|
|
|
// fprintf(stderr, "IODEBUG register 1 selected\n");
|
2001-09-15 02:38:06 +04:00
|
|
|
break;
|
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8A80:
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.register_select = 0;
|
2006-03-03 15:55:37 +03:00
|
|
|
bx_iodebug_c::add_range(bx_iodebug_s.registers[0],
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.registers[1]);
|
|
|
|
bx_iodebug_s.registers[0] = 0;
|
|
|
|
bx_iodebug_s.registers[1] = 0;
|
|
|
|
break;
|
|
|
|
|
2001-09-26 06:52:03 +04:00
|
|
|
#if BX_DEBUGGER
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8AE0:
|
|
|
|
fprintf(stderr, "request return to dbg prompt received, 0x8AE0 command (iodebug)\n");
|
2001-09-26 06:52:03 +04:00
|
|
|
bx_guard.interrupt_requested=1;
|
|
|
|
break;
|
2001-10-03 23:06:17 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8AE2:
|
|
|
|
fprintf(stderr, "request made by the guest os to disable tracing, iodebug port 0x8A00->0x8AE2\n");
|
2001-10-03 23:06:17 +04:00
|
|
|
BX_CPU(dbg_cpu)->trace = 0;
|
|
|
|
break;
|
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8AE3:
|
|
|
|
fprintf(stderr, "request made by the guest os to enable tracing, iodebug port 0x8A00->0x8AE3\n");
|
2001-10-03 23:06:17 +04:00
|
|
|
BX_CPU(dbg_cpu)->trace = 1;
|
|
|
|
break;
|
2001-10-03 23:54:29 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8AE4:
|
|
|
|
fprintf(stderr, "request made by the guest os to disable register tracing, iodebug port 0x8A00->0x8AE4\n");
|
2001-10-03 23:54:29 +04:00
|
|
|
BX_CPU(dbg_cpu)->trace_reg = 0;
|
|
|
|
break;
|
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8AE5:
|
|
|
|
fprintf(stderr, "request made by the guest os to enable register tracing, iodebug port 0x8A00->0x8AE5\n");
|
2001-10-03 23:54:29 +04:00
|
|
|
BX_CPU(dbg_cpu)->trace_reg = 1;
|
|
|
|
break;
|
2001-09-26 06:52:03 +04:00
|
|
|
#endif
|
2006-03-03 15:55:37 +03:00
|
|
|
case 0x8AFF:
|
2001-09-15 02:38:06 +04:00
|
|
|
bx_iodebug_s.enabled = 0;
|
2006-03-03 15:55:37 +03:00
|
|
|
// fprintf(stderr, "IODEBUG device deactivated\n");
|
2001-09-15 04:12:40 +04:00
|
|
|
// break;
|
2001-09-15 02:38:06 +04:00
|
|
|
|
2001-09-15 04:12:40 +04:00
|
|
|
// default:
|
|
|
|
// fprintf(stderr,"IODEBUG unsupported register code\n");
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-15 02:38:06 +04:00
|
|
|
// Static function
|
2008-05-02 00:46:58 +04:00
|
|
|
void bx_iodebug_c::mem_write(BX_CPU_C *cpu, bx_phy_address addr, unsigned len, void *data)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
if(! bx_iodebug_s.enabled) return;
|
2001-09-14 20:21:02 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
unsigned area = bx_iodebug_c::range_test(addr, len);
|
2001-09-14 20:21:02 +04:00
|
|
|
// Device is enabled, testing address ranges
|
2006-03-03 15:55:37 +03:00
|
|
|
if(area)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
|
|
|
area--;
|
2006-03-07 01:03:16 +03:00
|
|
|
|
2001-09-15 04:12:40 +04:00
|
|
|
#if BX_DEBUGGER
|
2008-02-15 22:03:54 +03:00
|
|
|
if (cpu != NULL) {
|
2009-05-12 19:03:07 +04:00
|
|
|
fprintf(stdout, "IODEBUG CPU %d @ eip: " FMT_ADDRX " write at monitored memory location %8X\n",
|
|
|
|
cpu->bx_cpuid, cpu->get_instruction_pointer(), addr);
|
2008-02-15 22:03:54 +03:00
|
|
|
}
|
|
|
|
else {
|
2006-03-07 01:03:16 +03:00
|
|
|
fprintf(stdout, "IODEBUG write at monitored memory location %8X\n", addr);
|
2008-02-15 22:03:54 +03:00
|
|
|
}
|
2005-11-14 22:03:12 +03:00
|
|
|
bx_guard.interrupt_requested=1;
|
2001-09-15 04:12:40 +04:00
|
|
|
#else
|
2006-03-07 01:03:16 +03:00
|
|
|
fprintf(stderr, "IODEBUG write to monitored memory area: %2i\t", area);
|
|
|
|
|
|
|
|
if (cpu != NULL)
|
2008-02-15 22:03:54 +03:00
|
|
|
fprintf(stderr, "by EIP:\t\t" FMT_ADDRX "\n\t", cpu->get_instruction_pointer());
|
2006-03-07 01:03:16 +03:00
|
|
|
else
|
2008-12-30 21:11:13 +03:00
|
|
|
fprintf(stderr, "(device origin)\t");
|
2006-03-07 01:03:16 +03:00
|
|
|
|
|
|
|
fprintf(stderr, "range start: \t\t%08X\trange end:\t%08X\n\taddress accessed:\t%08X\tdata written:\t",
|
2008-12-30 21:11:13 +03:00
|
|
|
bx_iodebug_s.monitored_mem_areas_start[area],
|
|
|
|
bx_iodebug_s.monitored_mem_areas_end[area],
|
|
|
|
(unsigned) addr);
|
2001-09-14 20:21:02 +04:00
|
|
|
|
|
|
|
switch(len)
|
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
case 1: {
|
|
|
|
Bit8u data8 = * ((Bit8u *) data);
|
|
|
|
fprintf(stderr,"%02X\n", (unsigned) data8);
|
2001-09-14 20:21:02 +04:00
|
|
|
break;
|
2006-03-03 15:55:37 +03:00
|
|
|
}
|
|
|
|
case 2: {
|
|
|
|
Bit16u data16 = * ((Bit16u *) data);
|
|
|
|
fprintf(stderr,"%04X\n", (unsigned) data16);
|
2001-09-14 20:21:02 +04:00
|
|
|
break;
|
2006-03-03 15:55:37 +03:00
|
|
|
}
|
|
|
|
case 4: {
|
|
|
|
Bit32u data32 = * ((Bit32u *) data);
|
|
|
|
fprintf(stderr,"%08X\n", (unsigned) data32);
|
2001-09-14 20:21:02 +04:00
|
|
|
break;
|
2006-03-03 15:55:37 +03:00
|
|
|
}
|
|
|
|
case 8: {
|
|
|
|
Bit64u data64 = * ((Bit64u *) data);
|
2008-01-27 01:24:03 +03:00
|
|
|
fprintf(stderr,"%08X%08x\n",
|
2006-03-03 15:55:37 +03:00
|
|
|
(unsigned) (data64 >> 32),
|
|
|
|
(unsigned) (data64 & 0xffffffff));
|
|
|
|
break;
|
|
|
|
}
|
2001-09-14 20:21:02 +04:00
|
|
|
default:
|
|
|
|
fprintf(stderr, "unsupported write size\n");
|
|
|
|
}
|
2001-09-15 04:12:40 +04:00
|
|
|
#endif
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-02 00:46:58 +04:00
|
|
|
void bx_iodebug_c::mem_read(BX_CPU_C *cpu, bx_phy_address addr, unsigned len, void *data)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
if(! bx_iodebug_s.enabled) return;
|
2001-09-14 20:21:02 +04:00
|
|
|
|
2006-03-03 15:55:37 +03:00
|
|
|
unsigned area = bx_iodebug_c::range_test(addr, len);
|
2001-09-15 04:12:40 +04:00
|
|
|
// Device is enabled, testing address ranges
|
2006-03-03 15:55:37 +03:00
|
|
|
if(area)
|
2001-09-15 04:12:40 +04:00
|
|
|
{
|
|
|
|
area--;
|
2006-03-07 01:03:16 +03:00
|
|
|
|
2001-09-15 04:12:40 +04:00
|
|
|
#if BX_DEBUGGER
|
2008-02-15 22:03:54 +03:00
|
|
|
if (cpu != NULL) {
|
2009-05-12 19:03:07 +04:00
|
|
|
fprintf(stdout, "IODEBUG CPU %d @ eip: " FMT_ADDRX " read at monitored memory location %8X\n",
|
|
|
|
cpu->bx_cpuid, cpu->get_instruction_pointer(), addr);
|
2008-02-15 22:03:54 +03:00
|
|
|
}
|
|
|
|
else {
|
2006-03-07 01:03:16 +03:00
|
|
|
fprintf(stdout, "IODEBUG read at monitored memory location %8X\n", addr);
|
2008-02-15 22:03:54 +03:00
|
|
|
}
|
2005-11-14 22:03:12 +03:00
|
|
|
bx_guard.interrupt_requested=1;
|
2001-09-15 04:12:40 +04:00
|
|
|
#else
|
2006-03-07 01:03:16 +03:00
|
|
|
fprintf(stderr, "IODEBUG read at monitored memory area: %2i\t", area);
|
|
|
|
|
|
|
|
if (cpu != NULL)
|
2008-02-15 22:03:54 +03:00
|
|
|
fprintf(stderr, "by EIP:\t\t" FMT_ADDRX "\n\t", cpu->get_instruction_pointer());
|
2006-03-07 01:03:16 +03:00
|
|
|
else
|
2008-12-30 21:11:13 +03:00
|
|
|
fprintf(stderr, "(device origin)\t");
|
2006-03-07 01:03:16 +03:00
|
|
|
|
|
|
|
fprintf(stderr, "range start: \t\t%08X\trange end:\t%08X\n\taddress accessed:\t%08X\tdata written:\t",
|
2001-09-15 04:12:40 +04:00
|
|
|
bx_iodebug_s.monitored_mem_areas_start[area],
|
|
|
|
bx_iodebug_s.monitored_mem_areas_end[area],
|
2006-03-03 15:55:37 +03:00
|
|
|
(unsigned) addr);
|
2001-09-15 04:12:40 +04:00
|
|
|
|
|
|
|
switch(len)
|
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
case 1: {
|
|
|
|
Bit8u data8 = * ((Bit8u *) data);
|
|
|
|
fprintf(stderr,"%02X\n", (unsigned) data8);
|
2001-09-15 04:12:40 +04:00
|
|
|
break;
|
2006-03-03 15:55:37 +03:00
|
|
|
}
|
|
|
|
case 2: {
|
|
|
|
Bit16u data16 = * ((Bit16u *) data);
|
|
|
|
fprintf(stderr,"%04X\n", (unsigned) data16);
|
2001-09-15 04:12:40 +04:00
|
|
|
break;
|
2006-03-03 15:55:37 +03:00
|
|
|
}
|
|
|
|
case 4: {
|
|
|
|
Bit32u data32 = * ((Bit32u *) data);
|
|
|
|
fprintf(stderr,"%08X\n", (unsigned) data32);
|
2001-09-15 04:12:40 +04:00
|
|
|
break;
|
2006-03-03 15:55:37 +03:00
|
|
|
}
|
|
|
|
case 8: {
|
|
|
|
Bit64u data64 = * ((Bit64u *) data);
|
2008-01-27 01:24:03 +03:00
|
|
|
fprintf(stderr,"%08X%08x\n",
|
2006-03-03 15:55:37 +03:00
|
|
|
(unsigned) (data64 >> 32),
|
|
|
|
(unsigned) (data64 & 0xffffffff));
|
|
|
|
break;
|
|
|
|
}
|
2001-09-15 04:12:40 +04:00
|
|
|
default:
|
2006-03-03 15:55:37 +03:00
|
|
|
fprintf(stderr, "unsupported read size\n");
|
2001-09-15 04:12:40 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
|
|
|
|
2008-05-02 00:46:58 +04:00
|
|
|
unsigned bx_iodebug_c::range_test(bx_phy_address addr, unsigned len)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
for(unsigned i=0;i<BX_IODEBUG_MAX_AREAS;i++)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2008-05-02 00:46:58 +04:00
|
|
|
if(bx_iodebug_s.monitored_mem_areas_start[i] != 0 ||
|
|
|
|
bx_iodebug_s.monitored_mem_areas_end[i] != 0)
|
2001-09-14 20:21:02 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
if((Bit32u)(addr+len-1) < bx_iodebug_s.monitored_mem_areas_start[i])
|
2001-09-14 20:21:02 +04:00
|
|
|
continue;
|
2006-03-03 15:55:37 +03:00
|
|
|
|
|
|
|
if(addr < bx_iodebug_s.monitored_mem_areas_end[i])
|
2001-09-15 02:38:06 +04:00
|
|
|
{
|
2001-09-14 20:21:02 +04:00
|
|
|
return(++i);
|
2001-09-15 02:38:06 +04:00
|
|
|
}
|
2001-09-14 20:21:02 +04:00
|
|
|
}
|
|
|
|
}
|
2006-03-03 15:55:37 +03:00
|
|
|
|
2001-09-15 02:38:06 +04:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
2008-05-02 00:46:58 +04:00
|
|
|
void bx_iodebug_c::add_range(bx_phy_address addr_start, bx_phy_address addr_end)
|
2001-09-15 02:38:06 +04:00
|
|
|
{
|
2006-03-03 15:55:37 +03:00
|
|
|
for(unsigned i=0;i<BX_IODEBUG_MAX_AREAS;i++)
|
2001-09-15 02:38:06 +04:00
|
|
|
{
|
2008-02-16 01:05:43 +03:00
|
|
|
if(!bx_iodebug_s.monitored_mem_areas_start[i] &&
|
|
|
|
!bx_iodebug_s.monitored_mem_areas_end[i])
|
2001-09-15 02:38:06 +04:00
|
|
|
{
|
|
|
|
bx_iodebug_s.monitored_mem_areas_start[i] = addr_start;
|
|
|
|
bx_iodebug_s.monitored_mem_areas_end[i] = addr_end;
|
2001-09-15 04:12:40 +04:00
|
|
|
// fprintf(stderr, "IODEBUG added range successfully in slot: %i\n",i);
|
2001-09-15 02:38:06 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-05-02 00:46:58 +04:00
|
|
|
//fprintf(stderr, "IODEBUG unable to register memory range, all slots taken\n");
|
2001-09-14 18:29:21 +04:00
|
|
|
}
|
2004-06-19 19:20:15 +04:00
|
|
|
|
2004-08-06 19:49:55 +04:00
|
|
|
#endif /* if BX_SUPPORT_IODEBUG */
|