#include "daScript/misc/platform.h"
#include "daScript/misc/sysos.h"
#if defined(_MSC_VER) && !defined(_GAMING_XBOX) && !defined(_DURANGO)
#define WIN32_LEAN_AND_MEAN
#include
namespace das {
__forceinline void setBits ( DWORD64 & dw, int lowBit, int bits, int newValue ) {
DWORD64 mask = (DWORD64(1) Dr0 );
if ( ExceptionInfo->ContextRecord->Dr6 & 2 ) g_HwBpHandler(1, (void *) ExceptionInfo->ContextRecord->Dr1 );
if ( ExceptionInfo->ContextRecord->Dr6 & 4 ) g_HwBpHandler(2, (void *) ExceptionInfo->ContextRecord->Dr2 );
if ( ExceptionInfo->ContextRecord->Dr6 & 8 ) g_HwBpHandler(3, (void *) ExceptionInfo->ContextRecord->Dr3 );
}
return EXCEPTION_CONTINUE_EXECUTION;
}
return EXCEPTION_CONTINUE_SEARCH;
}
void hwSetBreakpointHandler ( void (* handler ) ( int, void * ) ) {
g_HwBpHandler = handler;
}
int hwBreakpointSet ( void * address, int len, int when ) {
if ( !g_isVHSet ) {
g_isVHSet = true;
AddVectoredExceptionHandler(1, VEH_handler);
}
CONTEXT cxt;
HANDLE thisThread = GetCurrentThread();
cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS;
if ( !GetThreadContext(thisThread, &cxt) ) return -1;
int bp_index = 0;
for ( bp_index=0; bp_index!=4; ++bp_index ) {
uint32_t mask = uint32_t(1)