Exemplo n.º 1
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 );
    }
}
Exemplo n.º 2
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 );
}
Exemplo n.º 3
0
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 );
}
Exemplo n.º 4
0
static void SetDRnBW( int dr, dword linear, int len ) /* Set DRn for break on write */
{
    *DR[ dr ] = linear;
    SysRegs.dr7 |= ( ( DRLen( len )+DR7_BWR) << DR7_RWLSHIFT( dr ) )
                     | ( DR7_GEMASK << DR7_GLSHIFT( dr ) );
}