From 93587883f6aaa7f6ec034ddc7a01faf961e9ed6a Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Sat, 24 Feb 2024 12:20:01 +0000 Subject: x86: account for XSAVE when checking for AVX support Fixes #65 Part-of: --- orc/orccpu-x86.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/orc/orccpu-x86.c b/orc/orccpu-x86.c index f00f8ba..defa101 100644 --- a/orc/orccpu-x86.c +++ b/orc/orccpu-x86.c @@ -329,13 +329,18 @@ orc_x86_cpuid_handle_standard_flags (void) orc_x86_sse_flags |= ORC_TARGET_SSE_SSE4_2; } - if (ecx & (1 << 28)) { + // Linux mitigation for GDS requires checking for XSAVE too. + // https://bugzilla.mozilla.org/show_bug.cgi?id=1854795 + // https://gitlab.freedesktop.org/gstreamer/orc/-/issues/65 + const int xsave_enabled = ecx & (1 << 26); + + if (ecx & (1 << 28) && xsave_enabled) { orc_x86_sse_flags |= ORC_TARGET_AVX_AVX; } get_cpuid (0x00000007, &eax, &ebx, &ecx, &edx); - if (ebx & (1 << 5)) { + if (ebx & (1 << 5) && xsave_enabled) { orc_x86_sse_flags |= ORC_TARGET_AVX_AVX2; } } -- cgit v1.2.3