allow using k0 register

This commit is contained in:
torusrxxx 2025-03-16 11:25:56 +08:00
parent c37f9978fb
commit 1aae30c447
3 changed files with 6 additions and 8 deletions

View File

@ -681,7 +681,7 @@ typedef struct
#else // x86
ZmmRegister_t ZmmRegisters[8];
#endif
ULONGLONG Opmask[7]; // k0 is omitted; AVX-512BW extends these registers from 16 bits to 64 bits
ULONGLONG Opmask[8];
} TITAN_ENGINE_CONTEXT_AVX512_t;
#ifdef __cplusplus

View File

@ -1141,9 +1141,8 @@ __declspec(dllexport) bool TITCALL SetAVX512Context(HANDLE hActiveThread, TITAN_
if (Avx512_KMASK != NULL) //If the feature is unsupported by the processor it will return NULL
{
// k0 is always 0, don't store it.
for (int i = 1; i < MIN(FeatureLengthAvx512_KMASK / sizeof(ULONGLONG) - 1, _countof(titcontext->Opmask)); i++)
Avx512_KMASK[i] = titcontext->Opmask[i - 1];
for (int i = 0; i < MIN(FeatureLengthAvx512_KMASK / sizeof(ULONGLONG), _countof(titcontext->Opmask)); i++)
Avx512_KMASK[i] = titcontext->Opmask[i];
}
return (SetThreadContext(hActiveThread, Context) == TRUE);
@ -1241,9 +1240,8 @@ __declspec(dllexport) bool TITCALL GetAVX512Context(HANDLE hActiveThread, TITAN_
if (Avx512_KMASK != NULL) //If the feature is unsupported by the processor it will return NULL
{
// k0 is always 0, don't store it.
for (int i = 1; i < MIN(FeatureLengthAvx512_KMASK / sizeof(ULONGLONG) - 1, _countof(titcontext->Opmask)); i++)
titcontext->Opmask[i - 1] = Avx512_KMASK[i];
for (int i = 0; i < MIN(FeatureLengthAvx512_KMASK / sizeof(ULONGLONG), _countof(titcontext->Opmask)); i++)
titcontext->Opmask[i] = Avx512_KMASK[i];
}
return true;

View File

@ -203,7 +203,7 @@ typedef struct
#else // x86
ZmmRegister_t ZmmRegisters[8];
#endif
ULONGLONG Opmask[7]; // k0 is omitted; AVX-512BW extends these registers from 16 bits to 64 bits
ULONGLONG Opmask[8];
} TITAN_ENGINE_CONTEXT_AVX512_t;
typedef struct