Fixed cpuid assembly to work on PIC code
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404333
This commit is contained in:
parent
c825464c2f
commit
691ee6f7c0
1 changed files with 16 additions and 12 deletions
|
@ -122,16 +122,16 @@ done:
|
||||||
#elif defined(__sun) && defined(__i386)
|
#elif defined(__sun) && defined(__i386)
|
||||||
__asm (
|
__asm (
|
||||||
" pushfl \n"
|
" pushfl \n"
|
||||||
" popl %eax \n"
|
" popl %eax \n"
|
||||||
" movl %eax,%ecx \n"
|
" movl %eax,%ecx \n"
|
||||||
" xorl $0x200000,%eax \n"
|
" xorl $0x200000,%eax \n"
|
||||||
" pushl %eax \n"
|
" pushl %eax \n"
|
||||||
" popfl \n"
|
" popfl \n"
|
||||||
" pushfl \n"
|
" pushfl \n"
|
||||||
" popl %eax \n"
|
" popl %eax \n"
|
||||||
" xorl %ecx,%eax \n"
|
" xorl %ecx,%eax \n"
|
||||||
" jz 1f \n"
|
" jz 1f \n"
|
||||||
" movl $1,-8(%ebp) \n"
|
" movl $1,-8(%ebp) \n"
|
||||||
"1: \n"
|
"1: \n"
|
||||||
);
|
);
|
||||||
#elif defined(__sun) && defined(__amd64)
|
#elif defined(__sun) && defined(__amd64)
|
||||||
|
@ -156,8 +156,12 @@ done:
|
||||||
|
|
||||||
#if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
|
#if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
|
||||||
#define cpuid(func, a, b, c, d) \
|
#define cpuid(func, a, b, c, d) \
|
||||||
__asm__ __volatile__ ("cpuid": \
|
__asm__ __volatile__ ( \
|
||||||
"=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (func))
|
" pushl %%ebx \n" \
|
||||||
|
" cpuid \n" \
|
||||||
|
" movl %%ebx, %%esi \n" \
|
||||||
|
" popl %%ebx \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