static int ClearDebugRegs( int trap ) { long dr6; int i; if( Flags.DRsOn ) { out( "tr=" ); out( hex( trap ) ); out( " dr6=" ); out( hex( GetDR6() ) ); out( "\r\n" ); if( trap == TRAP_WATCH_POINT ) { /* could be a 386 break point */ dr6 = GetDR6(); if( ( ( dr6 & DR6_B0 ) && IsBreak[0] ) || ( ( dr6 & DR6_B1 ) && IsBreak[1] ) || ( ( dr6 & DR6_B2 ) && IsBreak[2] ) || ( ( dr6 & DR6_B3 ) && IsBreak[3] ) ) { trap = TRAP_BREAK_POINT; } } for( i = 0; i < 4; ++i ) { IsBreak[ i ] = FALSE; } SetDR6( 0 ); SetDR7( 0 ); } return( trap ); }
void ClearDebugRegs( void ) { int i; for( i = 0; i < 4; i++) SetDRn( i, 0, 0 ); SetDR6( 0 ); SetDR7( 0 ); }
static bool SetDebugRegs() { int needed; int i; watch *wp; bool success; long rc; needed = 0; for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { needed += wp->dregs; } if( needed > 4 ) return( FALSE ); if( IsDPMI ) { success = TRUE; for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { wp->handle = -1; wp->handle2 = -1; } for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { _DBG2(( "Setting Watch On %8.8lx\r\n", wp->linear )); success = FALSE; rc = DPMISetWatch( wp->linear, wp->len, DPMI_WATCH_WRITE ); _DBG2(( "OK 1 = %d\r\n", rc >= 0 )); if( rc < 0 ) break; wp->handle = rc; if( wp->dregs == 2 ) { rc = DPMISetWatch( wp->linear+4, wp->len, DPMI_WATCH_WRITE ); _DBG2(( "OK 2 = %d\r\n", rc >= 0 )); if( rc <= 0 ) break; wp->handle2 = rc; } success = TRUE; } if( !success ) { ClearDebugRegs(); } return( success ); } else { int dr; unsigned long dr7; dr = 0; dr7 = 0; for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { dr7 |= SetDRn( dr, wp->linear, DRLen( wp->len ) | DR7_BWR ); ++dr; if( wp->dregs == 2 ) { dr7 |= SetDRn( dr, wp->linear+4, DRLen( wp->len ) | DR7_BWR ); ++dr; } } SetDR7( dr7 ); return( TRUE ); } }
void ClearDebugRegs() { int i; watch *wp; if( IsDPMI ) { for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { if( wp->handle >= 0 ) { DPMIClearWatch( wp->handle ); wp->handle = -1; } if( wp->handle2 >= 0 ) { DPMIClearWatch( wp->handle2 ); wp->handle2 = -1; } } } else { SetDR6( 0 ); SetDR7( 0 ); } }
static bool SetDebugRegs( void ) { int needed; int i; int dr; unsigned long dr7; unsigned long linear; watch *wp; bool watch386; if( !Flags.DRsOn ) return( FALSE ); needed = 0; for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { needed += wp->dregs; } dr = 0; dr7 = 0; if( needed > 4 ) { watch386 = FALSE; } else { for( i = WatchCount, wp = WatchPoints; i != 0; --i, ++wp ) { dr7 |= SetDRn( dr, wp->linear, DRLen( wp->len ) | DR7_BWR ); ++dr; if( wp->dregs == 2 ) { dr7 |= SetDRn( dr, wp->linear+4, DRLen( wp->len ) | DR7_BWR ); ++dr; } watch386 = TRUE; } } if( GotABadBreak && dr < 4 ) { linear = ( (unsigned long)BadBreak.segment << 4 ) + BadBreak.offset; dr7 |= SetDRn( dr, linear, DR7_L1 | DR7_BINST ); IsBreak[ dr ] = TRUE; ++dr; } SetDR7( dr7 ); return( watch386 ); }
int SetDebugRegs( void ) { int needed,i,dr; u_long dr7; watch_point *wp; needed = 0; for( i = 0; i < wpCount; i++) needed += wpList[i].dregs; if( needed > 4 ) return( FALSE ); dr = 0; dr7 = 0; for( i = 0, wp = wpList; i < wpCount; i++, wp++ ) { dr7 |= SetDRn( dr, wp->linear, DRLen( wp->len ) | DR7_BWR ); dr++; if( wp->dregs == 2 ) { dr7 |= SetDRn( dr, wp->linear+wp->len, DRLen( wp->len ) | DR7_BWR ); dr++; } } SetDR7( dr7 ); return( TRUE ); }