aboutsummaryrefslogtreecommitdiff
path: root/include
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
parent417aeaff542e6349694b6ebcdff127f926ec3c7e (diff)
downloadqemu-5d133dd839e80e48702916b629c8b396e28611c8.zip
qemu-5d133dd839e80e48702916b629c8b396e28611c8.tar.gz
qemu-5d133dd839e80e48702916b629c8b396e28611c8.tar.bz2
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')
-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 7adb12d..1451e8e 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 */