Make hw breakpoint match check a function - normally it should be called from read/write_virtual as well

This commit is contained in:
Stanislav Shwartsman 2007-12-03 20:49:24 +00:00
parent dbfa7a51e9
commit c58e95f611
3 changed files with 24 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.379 2007-11-30 08:49:12 sshwarts Exp $
// $Id: cpu.h,v 1.380 2007-12-03 20:49:24 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -3255,7 +3255,8 @@ public: // for now...
#if BX_X86_DEBUGGER
// x86 hardware debug support
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned size,
BX_SMF void hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw);
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len,
unsigned opa, unsigned opb);
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: paging.cc,v 1.94 2007-11-20 17:15:33 sshwarts Exp $
// $Id: paging.cc,v 1.95 2007-12-03 20:49:24 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1107,23 +1107,8 @@ page_fault:
void BX_CPU_C::access_linear(bx_address laddr, unsigned len, unsigned pl, unsigned rw, void *data)
{
#if BX_X86_DEBUGGER
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
// Only compare debug registers if any breakpoints are enabled
Bit32u dr6_bits;
unsigned opa, opb;
opa = BX_HWDebugMemRW; // Read or Write always compares vs 11b
if (rw==BX_READ) // only compares vs 11b
opb = opa;
else // BX_WRITE or BX_RW; also compare vs 01b
opb = BX_HWDebugMemW;
dr6_bits = hwdebug_compare(laddr, len, opa, opb);
if (dr6_bits) {
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
BX_CPU_THIS_PTR async_event = 1;
}
}
hwbreakpoint_match(laddr, len, rw);
#endif
Bit32u pageOffset = laddr & 0x00000fff;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.183 2007-11-27 22:12:45 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.184 2007-12-03 20:49:24 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2407,6 +2407,24 @@ void BX_CPU_C::SWAPGS(bxInstruction_c *i)
#endif
#if BX_X86_DEBUGGER
void BX_CPU_C::hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw)
{
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
// Only compare debug registers if any breakpoints are enabled
unsigned opa, opb;
opa = BX_HWDebugMemRW; // Read or Write always compares vs 11b
if (rw==BX_READ) // only compares vs 11b
opb = opa;
else // BX_WRITE or BX_RW; also compare vs 01b
opb = BX_HWDebugMemW;
Bit32u dr6_bits = hwdebug_compare(laddr, len, opa, opb);
if (dr6_bits) {
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
BX_CPU_THIS_PTR async_event = 1;
}
}
}
Bit32u BX_CPU_C::hwdebug_compare(bx_address laddr_0, unsigned size,
unsigned opa, unsigned opb)
{