performance improvement in GetContextDataEx

This commit is contained in:
mrexodia 2016-09-03 05:45:11 +02:00
parent 895f80996b
commit 6dc9dcd3cf
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 7 additions and 6 deletions

View File

@ -113,7 +113,7 @@ bool _SetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcont
return returnf; return returnf;
} }
bool _GetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext) bool _GetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext, bool avx)
{ {
CONTEXT DBGContext; CONTEXT DBGContext;
memset(&DBGContext, 0, sizeof(CONTEXT)); memset(&DBGContext, 0, sizeof(CONTEXT));
@ -203,7 +203,8 @@ bool _GetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcont
memcpy(&(titcontext->XmmRegisters[i]), & DBGContext.ExtendedRegisters[(10 + i) * 16], 16); memcpy(&(titcontext->XmmRegisters[i]), & DBGContext.ExtendedRegisters[(10 + i) * 16], 16);
#endif #endif
GetAVXContext(hActiveThread, titcontext); if(avx)
GetAVXContext(hActiveThread, titcontext);
return true; return true;
} }

View File

@ -25,7 +25,7 @@ extern LOCATEXSTATEFEATURE _LocateXStateFeature;
extern SETXSTATEFEATURESMASK _SetXStateFeaturesMask; extern SETXSTATEFEATURESMASK _SetXStateFeaturesMask;
bool _SetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext, bool AVX_PRIORITY); bool _SetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext, bool AVX_PRIORITY);
bool _GetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext); bool _GetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext, bool avx);
bool InitXState(void); bool InitXState(void);
#endif //_GLOBAL_ENGINE_CONTEXT_H #endif //_GLOBAL_ENGINE_CONTEXT_H

View File

@ -85,7 +85,7 @@ __declspec(dllexport) bool TITCALL GetFullContextDataEx(HANDLE hActiveThread, TI
if(SuspendThread(hActiveThread) == (DWORD) - 1) if(SuspendThread(hActiveThread) == (DWORD) - 1)
return false; return false;
returnf = _GetFullContextDataEx(hActiveThread, titcontext); returnf = _GetFullContextDataEx(hActiveThread, titcontext, true);
ResumeThread(hActiveThread); ResumeThread(hActiveThread);
@ -102,7 +102,7 @@ __declspec(dllexport) ULONG_PTR TITCALL GetContextDataEx(HANDLE hActiveThread, D
memset(&titcontext, 0, sizeof(titcontext)); memset(&titcontext, 0, sizeof(titcontext));
if(! _GetFullContextDataEx(hActiveThread, & titcontext)) if(! _GetFullContextDataEx(hActiveThread, & titcontext, false))
{ {
ResumeThread(hActiveThread); ResumeThread(hActiveThread);
return false; return false;
@ -397,7 +397,7 @@ __declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD
memset(&titcontext, 0, sizeof(titcontext)); memset(&titcontext, 0, sizeof(titcontext));
if(! _GetFullContextDataEx(hActiveThread, & titcontext)) if(! _GetFullContextDataEx(hActiveThread, & titcontext, IndexOfRegister >= UE_MXCSR))
{ {
ResumeThread(hActiveThread); ResumeThread(hActiveThread);
return false; return false;