diff options
author | Nick Foster | 2012-04-15 17:21:44 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-04-16 08:33:01 -0700 |
commit | 92db96430685e843443a00936328b3539354c83e (patch) | |
tree | f05285ca6e4d0d77a205ede742f1c76cb346fd3c | |
parent | c3f2c30a54c75575f464afdd7cd11a017fb07695 (diff) | |
download | gnuradio-92db96430685e843443a00936328b3539354c83e.tar.gz gnuradio-92db96430685e843443a00936328b3539354c83e.tar.bz2 gnuradio-92db96430685e843443a00936328b3539354c83e.zip |
Volk: also check to make sure OSXSAVE is enabled so you don't check XGETBV when OS has it disabled.
-rw-r--r-- | volk/gen/make_cpuid_c.py | 7 | ||||
-rw-r--r-- | volk/lib/gcc_x86_cpuid.h | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/volk/gen/make_cpuid_c.py b/volk/gen/make_cpuid_c.py index 4bd1ce5b1..c6bb5059e 100644 --- a/volk/gen/make_cpuid_c.py +++ b/volk/gen/make_cpuid_c.py @@ -73,6 +73,13 @@ static inline unsigned int cpuid_edx(unsigned int op) { cpuid_x86 (op, regs); return regs[3]; } + +static inline unsigned int xgetbv(void) { + //check to make sure that xgetbv is enabled in OS + int xgetbv_enabled = cpuid_ecx(1) >> 27 & 0x01; + if(xgetbv_enabled == 0) return 0; + return __xgetbv(); +} #endif """ diff --git a/volk/lib/gcc_x86_cpuid.h b/volk/lib/gcc_x86_cpuid.h index 95a6722f2..2345ed213 100644 --- a/volk/lib/gcc_x86_cpuid.h +++ b/volk/lib/gcc_x86_cpuid.h @@ -182,7 +182,7 @@ __get_cpuid (unsigned int __level, * check for AVX capability before executing. */ static __inline unsigned int -xgetbv(void) +__xgetbv(void) { unsigned int index, __eax, __edx; __asm__ ("xgetbv" : "=a"(__eax), "=d"(__edx) : "c" (index)); |