Implemented 64-bit version of cpuid code
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404336
This commit is contained in:
parent
0624fd8333
commit
8c0b853255
1 changed files with 9 additions and 1 deletions
|
@ -157,7 +157,7 @@ done:
|
||||||
return has_CPUID;
|
return has_CPUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
|
#if defined(__GNUC__) && defined(i386)
|
||||||
#define cpuid(func, a, b, c, d) \
|
#define cpuid(func, a, b, c, d) \
|
||||||
__asm__ __volatile__ ( \
|
__asm__ __volatile__ ( \
|
||||||
" pushl %%ebx \n" \
|
" pushl %%ebx \n" \
|
||||||
|
@ -165,6 +165,14 @@ done:
|
||||||
" movl %%ebx, %%esi \n" \
|
" movl %%ebx, %%esi \n" \
|
||||||
" popl %%ebx \n" : \
|
" popl %%ebx \n" : \
|
||||||
"=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
|
"=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
|
||||||
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
|
#define cpuid(func, a, b, c, d) \
|
||||||
|
__asm__ __volatile__ ( \
|
||||||
|
" pushq %%rbx \n" \
|
||||||
|
" cpuid \n" \
|
||||||
|
" movq %%rbx, %%rsi \n" \
|
||||||
|
" popq %%rbx \n" : \
|
||||||
|
"=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
|
||||||
#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
|
#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
|
||||||
#define cpuid(func, a, b, c, d) \
|
#define cpuid(func, a, b, c, d) \
|
||||||
__asm { \
|
__asm { \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue