mirror of https://github.com/x64dbg/TitanEngine
hopefully fixed a crash with getting/setting the AVX context on unsupported systems
This commit is contained in:
parent
60c7a748b4
commit
e3107e6dd3
|
|
@ -82,7 +82,7 @@ __declspec(dllexport) bool TITCALL _SetFullContextDataEx(HANDLE hActiveThread, T
|
|||
return false;
|
||||
}
|
||||
|
||||
DBGContext.EFlags = titcontext->eflags;
|
||||
DBGContext.EFlags = (DWORD)titcontext->eflags;
|
||||
DBGContext.Dr0 = titcontext->dr0;
|
||||
DBGContext.Dr1 = titcontext->dr1;
|
||||
DBGContext.Dr2 = titcontext->dr2;
|
||||
|
|
@ -1244,8 +1244,8 @@ __declspec(dllexport) bool TITCALL SetAVXContext(HANDLE hActiveThread, TITAN_ENG
|
|||
goto Cleanup;
|
||||
|
||||
Xmm = (PM128A)pfnLocateXStateFeature(Context, XSTATE_LEGACY_SSE, &FeatureLength);
|
||||
Ymm = (PM128A)pfnLocateXStateFeature(Context, XSTATE_AVX, NULL);
|
||||
|
||||
if(Xmm != NULL) //If the feature is unsupported by the processor it will return NULL
|
||||
{
|
||||
for(Index = 0; Index < FeatureLength / sizeof(* Ymm); Index += 1)
|
||||
{
|
||||
memcpy
|
||||
|
|
@ -1254,7 +1254,13 @@ __declspec(dllexport) bool TITCALL SetAVXContext(HANDLE hActiveThread, TITAN_ENG
|
|||
((char*) & (titcontext->YmmRegisters[32 * Index])),
|
||||
sizeof(Xmm[Index])
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
Ymm = (PM128A)pfnLocateXStateFeature(Context, XSTATE_AVX, NULL);
|
||||
if(Ymm != NULL) //If the feature is unsupported by the processor it will return NULL
|
||||
{
|
||||
for(Index = 0; Index < FeatureLength / sizeof(* Ymm); Index += 1)
|
||||
{
|
||||
memcpy
|
||||
(
|
||||
Ymm++,
|
||||
|
|
@ -1262,6 +1268,7 @@ __declspec(dllexport) bool TITCALL SetAVXContext(HANDLE hActiveThread, TITAN_ENG
|
|||
sizeof(Ymm[Index])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Success = SetThreadContext(hActiveThread, Context);
|
||||
if(Success == FALSE)
|
||||
|
|
@ -1330,9 +1337,9 @@ __declspec(dllexport) bool TITCALL GetAVXContext(HANDLE hActiveThread, TITAN_ENG
|
|||
if(Success == FALSE)
|
||||
goto Cleanup;
|
||||
|
||||
Ymm = (PM128A)pfnLocateXStateFeature(Context, XSTATE_AVX, &FeatureLength);
|
||||
Xmm = (PM128A)pfnLocateXStateFeature(Context, XSTATE_LEGACY_SSE, &FeatureLength);
|
||||
|
||||
if(Xmm != NULL) //If the feature is unsupported by the processor it will return NULL
|
||||
{
|
||||
for(Index = 0; Index < FeatureLength / sizeof(* Ymm); Index += 1)
|
||||
{
|
||||
memcpy
|
||||
|
|
@ -1341,6 +1348,14 @@ __declspec(dllexport) bool TITCALL GetAVXContext(HANDLE hActiveThread, TITAN_ENG
|
|||
Xmm++,
|
||||
sizeof(Xmm[Index])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ymm = (PM128A)pfnLocateXStateFeature(Context, XSTATE_AVX, &FeatureLength);
|
||||
if(Ymm != NULL) //If the feature is unsupported by the processor it will return NULL
|
||||
{
|
||||
for(Index = 0; Index < FeatureLength / sizeof(* Ymm); Index += 1)
|
||||
{
|
||||
memcpy
|
||||
(
|
||||
((char*) & (titcontext->YmmRegisters[32 * Index])) + sizeof(titcontext->XmmRegisters[Index]),
|
||||
|
|
@ -1348,6 +1363,7 @@ __declspec(dllexport) bool TITCALL GetAVXContext(HANDLE hActiveThread, TITAN_ENG
|
|||
sizeof(Ymm[Index])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
returnf = true;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue