Revision a9e3707d libavcodec/i386/cputest.c

View differences:

libavcodec/i386/cputest.c
4 4
#include <stdlib.h>
5 5
#include "../dsputil.h"
6 6

  
7
#define cpuid(index,eax,ebx,ecx,edx) \
8
    asm ("cpuid" \
9
         : "=a" (eax), "=b" (ebx), \
10
           "=c" (ecx), "=d" (edx) \
11
         : "a" (index) \
12
         : "cc")
7
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
8
static inline void cpuid(int index, int *eax, int *ebx, int *ecx, int *edx)
9
{
10
    asm ("pushl %%ebx\n\t"
11
         "cpuid\n\t"
12
         "movl %%ebx, %1\n\t"
13
         "popl %%ebx\n\t"
14
         : "=a" (*eax), "=m" (*ebx), 
15
           "=c" (*ecx), "=d" (*edx)
16
         : "a" (index)
17
         : "cc");
18
}
13 19

  
14 20
/* Function to test if multimedia instructions are supported...  */
15 21
int mm_support(void)
......
17 23
    int rval;
18 24
    int eax, ebx, ecx, edx;
19 25
    
20
    
21 26
    __asm__ __volatile__ (
22 27
                          /* See if CPUID instruction is supported ... */
23 28
                          /* ... Get copies of EFLAGS into eax and ecx */
......
42 47
    if (eax == ecx)
43 48
        return 0; /* CPUID not supported */
44 49
    
45
    cpuid(0, eax, ebx, ecx, edx);
50
    cpuid(0, &eax, &ebx, &ecx, &edx);
46 51

  
47 52
    if (ebx == 0x756e6547 &&
48 53
        edx == 0x49656e69 &&
......
50 55
        
51 56
        /* intel */
52 57
    inteltest:
53
        cpuid(1, eax, ebx, ecx, edx);
58
        cpuid(1, &eax, &ebx, &ecx, &edx);
54 59
        if ((edx & 0x00800000) == 0)
55 60
            return 0;
56 61
        rval = MM_MMX;
......
63 68
               edx == 0x69746e65 &&
64 69
               ecx == 0x444d4163) {
65 70
        /* AMD */
66
        cpuid(0x80000000, eax, ebx, ecx, edx);
71
        cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
67 72
        if ((unsigned)eax < 0x80000001)
68 73
            goto inteltest;
69
        cpuid(0x80000001, eax, ebx, ecx, edx);
74
        cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
70 75
        if ((edx & 0x00800000) == 0)
71 76
            return 0;
72 77
        rval = MM_MMX;
......
89 94
        */
90 95
        if (eax != 2) 
91 96
            goto inteltest;
92
        cpuid(0x80000001, eax, ebx, ecx, edx);
97
        cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
93 98
        if ((eax & 0x00800000) == 0)
94 99
            return 0;
95 100
        rval = MM_MMX;

Also available in: Unified diff