summary refs log tree commit diff stats
path: root/include/qemu/cpuid.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-10-25 18:40:48 +1000
committerRichard Henderson <richard.henderson@linaro.org>2023-03-05 13:44:07 -0800
commit5d133dd839e80e48702916b629c8b396e28611c8 (patch)
treec3efe42bb4b656db1ae526f2dcfdc4e238a2a1d9 /include/qemu/cpuid.h
parent417aeaff542e6349694b6ebcdff127f926ec3c7e (diff)
downloadfocaccia-qemu-5d133dd839e80e48702916b629c8b396e28611c8.tar.gz
focaccia-qemu-5d133dd839e80e48702916b629c8b396e28611c8.zip
include/qemu/cpuid: Introduce xgetbv_low
Replace the two uses of asm to expand xgetbv with an inline function.
Since one of the two has been using the mnemonic, assume that the
comment about "older versions of the assember" is obsolete, as even
that is 4 years old.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/qemu/cpuid.h')
-rw-r--r--include/qemu/cpuid.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/qemu/cpuid.h b/include/qemu/cpuid.h
index 7adb12d320..1451e8ef2f 100644
--- a/include/qemu/cpuid.h
+++ b/include/qemu/cpuid.h
@@ -71,4 +71,11 @@
 #define bit_LZCNT       (1 << 5)
 #endif
 
+static inline unsigned xgetbv_low(unsigned c)
+{
+    unsigned a, d;
+    asm("xgetbv" : "=a"(a), "=d"(d) : "c"(c));
+    return a;
+}
+
 #endif /* QEMU_CPUID_H */