mirror of
https://github.com/google/cpu_features.git
synced 2025-04-27 23:22:31 +02:00
Convert XGETBV to equivalent byte form in GetXCR0Eax (#69)
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' ```
This commit is contained in:
parent
7806502271
commit
084ec5cd0f
@ -41,7 +41,10 @@ Leaf CpuId(uint32_t leaf_id) {
|
|||||||
|
|
||||||
uint32_t GetXCR0Eax(void) {
|
uint32_t GetXCR0Eax(void) {
|
||||||
uint32_t eax, edx;
|
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;
|
return eax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user