Created
January 28, 2015 02:51
-
-
Save jlhg/bf746c4bd614f78b50df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp | |
index 5a970d5..ae2a059 100644 | |
--- a/modules/core/src/system.cpp | |
+++ b/modules/core/src/system.cpp | |
@@ -267,14 +267,17 @@ struct HWFeatures | |
: "cc" | |
); | |
#else | |
+ // We need to preserve ebx since we are compiling PIC code. | |
+ // This means we cannot use "=b" for the 2nd output register. | |
asm volatile | |
( | |
"pushl %%ebx\n\t" | |
"movl $7,%%eax\n\t" | |
"movl $0,%%ecx\n\t" | |
"cpuid\n\t" | |
+ "movl %%ebx,%1\n\t" | |
"popl %%ebx\n\t" | |
- : "=a"(cpuid_data[0]), "=b"(cpuid_data[1]), "=c"(cpuid_data[2]), "=d"(cpuid_data[3]) | |
+ : "=a"(cpuid_data[0]), "=r"(cpuid_data[1]), "=c"(cpuid_data[2]), "=d"(cpuid_data[3]) | |
: | |
: "cc" | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment