Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/google/cpu_features.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornatanbc <natanbc@users.noreply.github.com>2019-03-20 12:04:24 +0300
committerGuillaume Chatelet <chatelet.guillaume@gmail.com>2019-03-20 12:04:24 +0300
commit084ec5cd0f29c151f3c036065c74985004bda3dc (patch)
tree3bb450fa26d45299cb71b007f19a95d0afce0b58
parent7806502271dfe79b417f636839dd9de41a0be16f (diff)
Convert XGETBV to equivalent byte form in GetXCR0Eax (#69)v0.3.0
osxcross (https://github.com/tpoechtrager/osxcross) gives the following error, which also happens with regular gcc on OS X (https://github.com/asmjit/asmjit/issues/78): ``` cpu_features/src/cpuinfo_x86.c:44:no such instruction: `XGETBV' ```
-rw-r--r--src/cpuinfo_x86.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cpuinfo_x86.c b/src/cpuinfo_x86.c
index 2bec7bd..52f178f 100644
--- a/src/cpuinfo_x86.c
+++ b/src/cpuinfo_x86.c
@@ -41,7 +41,10 @@ Leaf CpuId(uint32_t leaf_id) {
uint32_t GetXCR0Eax(void) {
uint32_t eax, edx;
- __asm("XGETBV" : "=a"(eax), "=d"(edx) : "c"(0));
+ /* named form of xgetbv not supported on OSX, so must use byte form, see:
+ https://github.com/asmjit/asmjit/issues/78
+ */
+ __asm(".byte 0x0F, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
return eax;
}