src/cpuinfo/SDL_cpuinfo.c
changeset 3515 d94e331e85fa
parent 3499 4cf8a1423d57
child 3579 3427271a2d75
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Wed Dec 02 07:56:09 2009 +0000
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Dec 03 04:33:05 2009 +0000
     1.3 @@ -156,10 +156,12 @@
     1.4  "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
     1.5  "        pushl   %%ebx                                                 \n"
     1.6  "        cpuid                       # Get and save vendor ID          \n"
     1.7 +"        popl    %%ebx                                                 \n"
     1.8  "        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
     1.9  "        jl      1f                  # We dont have the CPUID instruction\n"
    1.10  "        xorl    %%eax,%%eax                                           \n"
    1.11  "        incl    %%eax                                                 \n"
    1.12 +"        pushl   %%ebx                                                 \n"
    1.13  "        cpuid                       # Get family/model/stepping/features\n"
    1.14  "        popl    %%ebx                                                 \n"
    1.15  "        movl    %%edx,%0                                              \n"
    1.16 @@ -171,14 +173,16 @@
    1.17  #elif defined(__GNUC__) && defined(__x86_64__)
    1.18  	__asm__ (
    1.19  "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
    1.20 -"        pushq   %%rbx\n"
    1.21 +"        pushq   %%rbx                                                 \n"
    1.22  "        cpuid                       # Get and save vendor ID          \n"
    1.23 +"        popq    %%rbx                                                 \n"
    1.24  "        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
    1.25  "        jl      1f                  # We dont have the CPUID instruction\n"
    1.26  "        xorl    %%eax,%%eax                                           \n"
    1.27  "        incl    %%eax                                                 \n"
    1.28 +"        pushq   %%rbx                                                 \n"
    1.29  "        cpuid                       # Get family/model/stepping/features\n"
    1.30 -"        popq    %%rbx\n"
    1.31 +"        popq    %%rbx                                                 \n"
    1.32  "        movl    %%edx,%0                                              \n"
    1.33  "1:                                                                    \n"
    1.34  	: "=m" (features)
    1.35 @@ -190,10 +194,12 @@
    1.36          xor     eax, eax            ; Set up for CPUID instruction
    1.37          push    ebx
    1.38          cpuid                       ; Get and save vendor ID
    1.39 +        pop     ebx
    1.40          cmp     eax, 1              ; Make sure 1 is valid input for CPUID
    1.41          jl      done                ; We dont have the CPUID instruction
    1.42          xor     eax, eax
    1.43          inc     eax
    1.44 +        push    ebx
    1.45          cpuid                       ; Get family/model/stepping/features
    1.46          pop     ebx
    1.47          mov     features, edx
    1.48 @@ -204,10 +210,12 @@
    1.49  "        xorl    %eax,%eax         \n"
    1.50  "        pushl   %ebx              \n"
    1.51  "        cpuid                     \n"
    1.52 +"        popl    %ebx              \n"
    1.53  "        cmpl    $1,%eax           \n"
    1.54  "        jl      1f                \n"
    1.55  "        xorl    %eax,%eax         \n"
    1.56  "        incl    %eax              \n"
    1.57 +"        pushl   %ebx              \n"
    1.58  "        cpuid                     \n"
    1.59  "        popl    %ebx              \n"
    1.60  #ifdef __i386
    1.61 @@ -231,9 +239,11 @@
    1.62  "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
    1.63  "        pushl   %%ebx                                                 \n"
    1.64  "        cpuid                       # Get extended function limit     \n"
    1.65 +"        popl    %%ebx                                                 \n"
    1.66  "        cmpl    $0x80000001,%%eax                                     \n"
    1.67  "        jl      1f                  # Nope, we dont have function 800000001h\n"
    1.68  "        movl    $0x80000001,%%eax   # Setup extended function 800000001h\n"
    1.69 +"        pushl   %%ebx                                                 \n"
    1.70  "        cpuid                       # and get the information         \n"
    1.71  "        popl    %%ebx                                                 \n"
    1.72  "        movl    %%edx,%0                                              \n"
    1.73 @@ -247,9 +257,11 @@
    1.74  "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
    1.75  "        pushq   %%rbx                                                 \n"
    1.76  "        cpuid                       # Get extended function limit     \n"
    1.77 +"        popq    %%rbx                                                 \n"
    1.78  "        cmpl    $0x80000001,%%eax                                     \n"
    1.79  "        jl      1f                  # Nope, we dont have function 800000001h\n"
    1.80  "        movl    $0x80000001,%%eax   # Setup extended function 800000001h\n"
    1.81 +"        pushq   %%rbx                                                 \n"
    1.82  "        cpuid                       # and get the information         \n"
    1.83  "        popq    %%rbx                                                 \n"
    1.84  "        movl    %%edx,%0                                              \n"
    1.85 @@ -263,9 +275,11 @@
    1.86          mov     eax,80000000h       ; Query for extended functions
    1.87          push    ebx
    1.88          cpuid                       ; Get extended function limit
    1.89 +        pop     ebx
    1.90          cmp     eax,80000001h
    1.91          jl      done                ; Nope, we dont have function 800000001h
    1.92          mov     eax,80000001h       ; Setup extended function 800000001h
    1.93 +        push    ebx
    1.94          cpuid                       ; and get the information
    1.95          pop     ebx
    1.96          mov     features,edx
    1.97 @@ -276,9 +290,11 @@
    1.98  "        movl    $0x80000000,%eax \n"
    1.99  "        pushl   %ebx             \n"
   1.100  "        cpuid                    \n"
   1.101 +"        popl    %ebx             \n"
   1.102  "        cmpl    $0x80000001,%eax \n"
   1.103  "        jl      1f               \n"
   1.104  "        movl    $0x80000001,%eax \n"
   1.105 +"        pushl   %ebx             \n"
   1.106  "        cpuid                    \n"
   1.107  "        popl    %ebx             \n"
   1.108  #ifdef __i386