cvg, h5, cpuid.c: fixed strict aliasing issue with newer gcc versions.
This commit is contained in:
@@ -33,14 +33,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cpuid.h"
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3)))
|
||||
typedef unsigned int __attribute__((__may_alias__)) word32;
|
||||
#else
|
||||
typedef unsigned int word32;
|
||||
#endif
|
||||
|
||||
/* These are the bit flags that get set on calling cpuid
|
||||
* with register eax set to 1
|
||||
@@ -87,7 +90,6 @@ typedef unsigned int word32;
|
||||
static jmp_buf j;
|
||||
|
||||
|
||||
|
||||
/* Desc: signal handler
|
||||
*
|
||||
* In : signal number
|
||||
@@ -101,7 +103,6 @@ static void handler (int signal)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Desc: check if CPU has specific feature
|
||||
*
|
||||
* In : feature request
|
||||
@@ -135,7 +136,6 @@ static int check_feature (int feature)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Desc: perform (possibly faulting) instructions in a safe manner
|
||||
*
|
||||
* In : feature request
|
||||
@@ -182,7 +182,6 @@ static int has_feature (int feature)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Desc: get CPU info
|
||||
*
|
||||
* In : pointer to _p_info
|
||||
@@ -234,7 +233,7 @@ int _cpuid (_p_info *pinfo)
|
||||
movl %%edx, %0 \n\
|
||||
0: \n\
|
||||
":"=g"(dwExt), "=g"(dwId), "=g"(dwFeature),
|
||||
"=g"(((long *)Ident)[0]), "=g"(((long *)Ident)[1]), "=g"(((long *)Ident)[2])
|
||||
"=g"(((word32 *)Ident)[0]), "=g"(((word32 *)Ident)[1]), "=g"(((word32 *)Ident)[2])
|
||||
::"%eax", "%ecx", "%edx");
|
||||
#else
|
||||
_asm
|
||||
@@ -315,7 +314,6 @@ notamd:
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if CPUTEST
|
||||
#include <stdio.h>
|
||||
/* Desc:
|
||||
|
||||
@@ -30,14 +30,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cpuid.h"
|
||||
|
||||
typedef unsigned long word32;
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3)))
|
||||
typedef unsigned int __attribute__((__may_alias__)) word32;
|
||||
#else
|
||||
typedef unsigned int word32;
|
||||
#endif
|
||||
|
||||
/* These are the bit flags that get set on calling cpuid
|
||||
* with register eax set to 1
|
||||
@@ -84,7 +87,6 @@ typedef unsigned long word32;
|
||||
static jmp_buf j;
|
||||
|
||||
|
||||
|
||||
/* Desc: signal handler
|
||||
*
|
||||
* In : signal number
|
||||
@@ -98,7 +100,6 @@ static void handler (int signal)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Desc: check if CPU has specific feature
|
||||
*
|
||||
* In : feature request
|
||||
@@ -132,7 +133,6 @@ static int check_feature (int feature)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Desc: perform (possibly faulting) instructions in a safe manner
|
||||
*
|
||||
* In : feature request
|
||||
@@ -179,7 +179,6 @@ static int has_feature (int feature)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Desc: get CPU info
|
||||
*
|
||||
* In : pointer to _p_info
|
||||
@@ -231,7 +230,7 @@ int _cpuid (_p_info *pinfo)
|
||||
movl %%edx, %0 \n\
|
||||
0: \n\
|
||||
":"=g"(dwExt), "=g"(dwId), "=g"(dwFeature),
|
||||
"=g"(((long *)Ident)[0]), "=g"(((long *)Ident)[1]), "=g"(((long *)Ident)[2])
|
||||
"=g"(((word32 *)Ident)[0]), "=g"(((word32 *)Ident)[1]), "=g"(((word32 *)Ident)[2])
|
||||
::"%eax", "%ecx", "%edx");
|
||||
#else
|
||||
_asm
|
||||
@@ -312,7 +311,6 @@ notamd:
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if CPUTEST
|
||||
#include <stdio.h>
|
||||
/* Desc:
|
||||
|
||||
Reference in New Issue
Block a user