summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/aws-c-common/source/arch/intel/asm
diff options
context:
space:
mode:
authorrobot-contrib <[email protected]>2025-05-14 06:53:03 +0300
committerrobot-contrib <[email protected]>2025-05-14 07:05:42 +0300
commit286dbc77293811055ff4f9303cd376eff9e50104 (patch)
treea50eea3eb2b824c7c68e15b4cc3e127731776d32 /contrib/restricted/aws/aws-c-common/source/arch/intel/asm
parent0bf9db6399352012396e7791bcfd762e944b33c2 (diff)
Update contrib/restricted/aws/aws-c-common to 0.12.2
commit_hash:fc6e67f9b12b0b888c90bb97bf2b1cbfcd74a044
Diffstat (limited to 'contrib/restricted/aws/aws-c-common/source/arch/intel/asm')
-rw-r--r--contrib/restricted/aws/aws-c-common/source/arch/intel/asm/cpuid.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/restricted/aws/aws-c-common/source/arch/intel/asm/cpuid.c b/contrib/restricted/aws/aws-c-common/source/arch/intel/asm/cpuid.c
index d2ceab01060..93657460e63 100644
--- a/contrib/restricted/aws/aws-c-common/source/arch/intel/asm/cpuid.c
+++ b/contrib/restricted/aws/aws-c-common/source/arch/intel/asm/cpuid.c
@@ -27,3 +27,14 @@ void aws_run_cpuid(uint32_t eax, uint32_t ecx, uint32_t *abcd) {
abcd[2] = ecx;
abcd[3] = edx;
}
+
+uint64_t aws_run_xgetbv(uint32_t xcr) {
+ /* NOTE: we could have used the _xgetbv() intrinsic in <immintrin.h>, but it's missing from GCC < 9.0:
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71659 */
+
+ /* xgetbv writes high and low of 64bit value to EDX:EAX */
+ uint32_t xcrhigh;
+ uint32_t xcrlow;
+ __asm__ __volatile__("xgetbv" : "=a"(xcrlow), "=d"(xcrhigh) : "c"(xcr));
+ return (((uint64_t)xcrhigh) << 32) | xcrlow;
+}