nir: Add nir_foreach_shader_in/out_variable helpers
[mesa.git] / src / mesa / x86 / common_x86.c
index 25f5c40e21c00e16a87a30361d4f3aba401ffce2..a237fc0c9973a74723e15852ff53377bc5af4fab 100644 (file)
  */
 
 /* XXX these includes should probably go into imports.h or glheader.h */
-#if defined(USE_SSE_ASM) && defined(__linux__)
-#include <linux/version.h>
-#endif
 #if defined(USE_SSE_ASM) && defined(__FreeBSD__)
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #endif
-#if defined(USE_SSE_ASM) && defined(__OpenBSD__)
+#if defined(USE_SSE_ASM) && (defined(__OpenBSD__) || defined(__NetBSD__))
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <machine/cpu.h>
 #endif
 #endif
 
-#include "main/imports.h"
+#include <stdlib.h>
+
+#include "main/errors.h"
+
 #include "common_x86_asm.h"
 
 
@@ -68,12 +68,12 @@ static int detection_debug = GL_FALSE;
 
 /* No reason for this to be public.
  */
-extern GLuint  _ASMAPI _mesa_x86_has_cpuid(void);
-extern void    _ASMAPI _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx);
-extern GLuint  _ASMAPI _mesa_x86_cpuid_eax(GLuint op);
-extern GLuint  _ASMAPI _mesa_x86_cpuid_ebx(GLuint op);
-extern GLuint  _ASMAPI _mesa_x86_cpuid_ecx(GLuint op);
-extern GLuint  _ASMAPI _mesa_x86_cpuid_edx(GLuint op);
+extern GLuint _mesa_x86_has_cpuid(void);
+extern void _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx);
+extern GLuint _mesa_x86_cpuid_eax(GLuint op);
+extern GLuint _mesa_x86_cpuid_ebx(GLuint op);
+extern GLuint _mesa_x86_cpuid_ecx(GLuint op);
+extern GLuint _mesa_x86_cpuid_edx(GLuint op);
 
 
 #if defined(USE_SSE_ASM)
@@ -160,10 +160,10 @@ void _mesa_check_os_sse_support( void )
    }
 #elif defined(_WIN32)
    LPTOP_LEVEL_EXCEPTION_FILTER oldFilter;
-   
+
    /* Install our ExceptionFilter */
    oldFilter = SetUnhandledExceptionFilter( ExceptionFilter );
-   
+
    if ( cpu_has_xmm ) {
       _mesa_debug(NULL, "Testing OS support for SSE...\n");
 
@@ -344,13 +344,13 @@ _mesa_get_x86_features(void)
 
 #elif defined(USE_X86_64_ASM)
    {
-      unsigned int uninitialized_var(eax), uninitialized_var(ebx),
-                   uninitialized_var(ecx), uninitialized_var(edx);
+      unsigned int eax, ebx, ecx, edx;
 
       /* Always available on x86-64. */
       _mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2;
 
-      __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+      if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx))
+         return;
 
       if (ecx & bit_SSE4_1)
          _mesa_x86_cpu_features |= X86_FEATURE_SSE4_1;