Revision bdde476a target-i386/cpuid.c
b/target-i386/cpuid.c | ||
---|---|---|
92 | 92 |
int check_cpuid = 0; |
93 | 93 |
int enforce_cpuid = 0; |
94 | 94 |
|
95 |
static void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, |
|
96 |
uint32_t *ebx, uint32_t *ecx, uint32_t *edx); |
|
95 |
static void host_cpuid(uint32_t function, uint32_t count, |
|
96 |
uint32_t *eax, uint32_t *ebx, |
|
97 |
uint32_t *ecx, uint32_t *edx) |
|
98 |
{ |
|
99 |
#if defined(CONFIG_KVM) |
|
100 |
uint32_t vec[4]; |
|
101 |
|
|
102 |
#ifdef __x86_64__ |
|
103 |
asm volatile("cpuid" |
|
104 |
: "=a"(vec[0]), "=b"(vec[1]), |
|
105 |
"=c"(vec[2]), "=d"(vec[3]) |
|
106 |
: "0"(function), "c"(count) : "cc"); |
|
107 |
#else |
|
108 |
asm volatile("pusha \n\t" |
|
109 |
"cpuid \n\t" |
|
110 |
"mov %%eax, 0(%2) \n\t" |
|
111 |
"mov %%ebx, 4(%2) \n\t" |
|
112 |
"mov %%ecx, 8(%2) \n\t" |
|
113 |
"mov %%edx, 12(%2) \n\t" |
|
114 |
"popa" |
|
115 |
: : "a"(function), "c"(count), "S"(vec) |
|
116 |
: "memory", "cc"); |
|
117 |
#endif |
|
118 |
|
|
119 |
if (eax) |
|
120 |
*eax = vec[0]; |
|
121 |
if (ebx) |
|
122 |
*ebx = vec[1]; |
|
123 |
if (ecx) |
|
124 |
*ecx = vec[2]; |
|
125 |
if (edx) |
|
126 |
*edx = vec[3]; |
|
127 |
#endif |
|
128 |
} |
|
97 | 129 |
|
98 | 130 |
#define iswhite(c) ((c) && ((c) <= ' ' || '~' < (c))) |
99 | 131 |
|
... | ... | |
896 | 928 |
#endif |
897 | 929 |
} |
898 | 930 |
|
899 |
static void host_cpuid(uint32_t function, uint32_t count, |
|
900 |
uint32_t *eax, uint32_t *ebx, |
|
901 |
uint32_t *ecx, uint32_t *edx) |
|
902 |
{ |
|
903 |
#if defined(CONFIG_KVM) |
|
904 |
uint32_t vec[4]; |
|
905 |
|
|
906 |
#ifdef __x86_64__ |
|
907 |
asm volatile("cpuid" |
|
908 |
: "=a"(vec[0]), "=b"(vec[1]), |
|
909 |
"=c"(vec[2]), "=d"(vec[3]) |
|
910 |
: "0"(function), "c"(count) : "cc"); |
|
911 |
#else |
|
912 |
asm volatile("pusha \n\t" |
|
913 |
"cpuid \n\t" |
|
914 |
"mov %%eax, 0(%2) \n\t" |
|
915 |
"mov %%ebx, 4(%2) \n\t" |
|
916 |
"mov %%ecx, 8(%2) \n\t" |
|
917 |
"mov %%edx, 12(%2) \n\t" |
|
918 |
"popa" |
|
919 |
: : "a"(function), "c"(count), "S"(vec) |
|
920 |
: "memory", "cc"); |
|
921 |
#endif |
|
922 |
|
|
923 |
if (eax) |
|
924 |
*eax = vec[0]; |
|
925 |
if (ebx) |
|
926 |
*ebx = vec[1]; |
|
927 |
if (ecx) |
|
928 |
*ecx = vec[2]; |
|
929 |
if (edx) |
|
930 |
*edx = vec[3]; |
|
931 |
#endif |
|
932 |
} |
|
933 |
|
|
934 | 931 |
static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx, |
935 | 932 |
uint32_t *ecx, uint32_t *edx) |
936 | 933 |
{ |
Also available in: Unified diff