X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/81ceb2c35de440e701d2f4e6960001395d2b7e97..e1ac8bd99e01882b7dba40efb83941a1b60f024d:/base/dispatch-x86ish.S diff --git a/base/dispatch-x86ish.S b/base/dispatch-x86ish.S index 57d8d32b..8a4c7b2e 100644 --- a/base/dispatch-x86ish.S +++ b/base/dispatch-x86ish.S @@ -155,6 +155,43 @@ FUNC(dispatch_x86ish_xmmregisters_p) ENDFUNC ///-------------------------------------------------------------------------- +/// Checking extended control registers. + +FUNC(dispatch_x86ish_xgetbv) + // Call with two arguments: a pointer Z_OUT to 8 bytes of output space, and + // a 32-bit integer C. Read the 64-bit value of XCR(C), and store it + // at Z_OUT. + +#if CPUFAM_X86 +# define Z_OUT edi + pushreg edi + mov edi, [esp + 8] + mov ecx, [esp + 12] +#endif +#if CPUFAM_AMD64 && ABI_SYSV +# define Z_OUT rdi + mov ecx, esi +#endif +#if CPUFAM_AMD64 && ABI_WIN +# define Z_OUT r8 + mov r8, rcx + mov ecx, edx +#endif + endprologue + + xgetbv + mov [Z_OUT + 0], eax + mov [Z_OUT + 4], edx + +#if CPUFAM_X86 + popreg edi +#endif + ret + +#undef Z_OUT +ENDFUNC + +///-------------------------------------------------------------------------- /// Checking `rdrand'. FUNC(dispatch_x86ish_rdrand)