cpuid 0.2.2.1 → 0.2.2.2
raw patch · 5 files changed
+49/−23 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- cbits/cpuid-pic-i386.c +15/−0
- cbits/cpuid-pic-x86_64.c +16/−0
- cbits/cpuid-pic.c +0/−15
- cbits/cpuid.c +9/−1
- cpuid.cabal +9/−7
+ cbits/cpuid-pic-i386.c view
@@ -0,0 +1,15 @@+// http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inlin+#include <stdint.h>++void+cpuid_array(uint32_t op, uint32_t reg[4])+{+ asm volatile(+ "pushl %%ebx \n" /* save %ebx */+ "cpuid \n"+ "movl %%ebx, %1 \n" /* save what cpuid just put in %ebx */+ "popl %%ebx \n" /* restore the old %ebx */+ : "=a"(reg[0]), "=r"(reg[1]), "=c"(reg[2]), "=d"(reg[3])+ : "a"(op)+ : "cc");+}
+ cbits/cpuid-pic-x86_64.c view
@@ -0,0 +1,16 @@+// http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inlin+// http://stackoverflow.com/questions/6268745/invalid-instruction-suffix-for-push-when-assembling-with-gas+#include <stdint.h>++void+cpuid_array(uint32_t op, uint32_t reg[4])+{+ asm volatile(+ "pushq %%rbx \n" /* save %ebx */+ "cpuid \n"+ "movl %%ebx, %1 \n" /* save what cpuid just put in %ebx */+ "popq %%rbx \n" /* restore the old %ebx */+ : "=a"(reg[0]), "=r"(reg[1]), "=c"(reg[2]), "=d"(reg[3])+ : "a"(op)+ : "cc");+}
− cbits/cpuid-pic.c
@@ -1,15 +0,0 @@-// http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inlin-#include <stdint.h>--void-cpuid_array(uint32_t op, uint32_t reg[4])-{- asm volatile(- "pushl %%ebx \n" /* save %ebx */- "cpuid \n"- "movl %%ebx, %1 \n" /* save what cpuid just put in %ebx */- "popl %%ebx \n" /* restore the old %ebx */- : "=a"(reg[0]), "=r"(reg[1]), "=c"(reg[2]), "=d"(reg[3])- : "a"(op)- : "cc");-}
cbits/cpuid.c view
@@ -1,5 +1,13 @@+/*+gcc shows its symbols when running:+echo | gcc -E -dM -+*/ #ifdef __PIC__-#include "cpuid-pic.c"+#ifdef __x86_64__+#include "cpuid-pic-x86_64.c"+#else+#include "cpuid-pic-i386.c"+#endif #else #include "cpuid-pdc.c" #endif
cpuid.cabal view
@@ -1,5 +1,5 @@ Name: cpuid-Version: 0.2.2.1+Version: 0.2.2.2 License: GPL License-file: COPYING Author: Martin Grabmueller <martin@grabmueller.de>@@ -19,7 +19,8 @@ Extra-source-files: README- cbits/cpuid-pic.c+ cbits/cpuid-pic-i386.c+ cbits/cpuid-pic-x86_64.c cbits/cpuid-pdc.c Flag buildExamples@@ -31,12 +32,13 @@ Location: http://code.haskell.org/cpuid/ Library- If !arch(i386)+ If arch(i386) || arch(x86_64)+ Build-depends:+ data-accessor >=0.2.2 && <0.3,+ enumset >=0.0.3 && <0.1,+ base >=4 && < 5+ Else Buildable: False- Build-depends:- data-accessor >=0.2.2 && <0.3,- enumset >=0.0.3 && <0.1,- base >=4 && < 5 Exposed-Modules: System.Cpuid Extensions: ForeignFunctionInterface C-sources: cbits/cpuid.c