[cvs] / xvidcore / src / utils / x86_asm / cpuid.asm Repository:
ViewVC logotype

Diff of /xvidcore/src/utils/x86_asm/cpuid.asm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Fri Mar 8 02:45:00 2002 UTC revision 1.2, Thu Jul 18 13:44:39 2002 UTC
# Line 78  Line 78 
78    
79  section .data  section .data
80    
 features        dd 0  
   
 vendor          dd 0,0,0  
81  vendorAMD       db "AuthenticAMD"  vendorAMD       db "AuthenticAMD"
82    
83  %macro  CHECK_FEATURE         3  %macro  CHECK_FEATURE         3
# Line 90  Line 87 
87      neg     ecx      neg     ecx
88      sbb     ecx, ecx      sbb     ecx, ecx
89      and     ecx, %2      and     ecx, %2
90      or      [%3], ecx      or      %3, ecx
91    
92  %endmacro  %endmacro
93    
# Line 101  Line 98 
98  cglobal check_cpu_features  cglobal check_cpu_features
99  check_cpu_features:  check_cpu_features:
100    
101          pushad          push ebx
102          pushfd          push esi
103            push edi
104            push ebp
105    
106            xor ebp,ebp
107    
108          ; CPUID command ?          ; CPUID command ?
109            pushfd
110          pop             eax          pop             eax
111          mov             ecx, eax          mov             ecx, eax
112          xor             eax, 0x200000          xor             eax, 0x200000
# Line 120  Line 122 
122          ; get vendor string, used later          ; get vendor string, used later
123      xor     eax, eax      xor     eax, eax
124      cpuid      cpuid
125      mov     [vendor], ebx       ; vendor string      mov     [esp-12], ebx       ; vendor string
126      mov     [vendor+4], edx      mov     [esp-12+4], edx
127      mov     [vendor+8], ecx      mov     [esp-12+8], ecx
128      test    eax, eax      test    eax, eax
129    
130      jz      near .cpu_quit      jz      near .cpu_quit
# Line 130  Line 132 
132      mov     eax, 1      mov     eax, 1
133      cpuid      cpuid
134    
   
135      ; RDTSC command ?      ; RDTSC command ?
136          CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, features          CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, ebp
137    
138      ; MMX support ?      ; MMX support ?
139          CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, features          CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, ebp
140    
141      ; SSE support ?      ; SSE support ?
142          CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT+XVID_CPU_SSE), features          CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT|XVID_CPU_SSE), ebp
143    
144          ; SSE2 support?          ; SSE2 support?
145          CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, features          CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, ebp
   
146    
147          ; extended functions?          ; extended functions?
148      mov     eax, 0x80000000      mov     eax, 0x80000000
# Line 153  Line 153 
153      mov     eax, 0x80000001      mov     eax, 0x80000001
154      cpuid      cpuid
155    
     ; 3DNow! support ?  
         CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, features  
   
156          ; AMD cpu ?          ; AMD cpu ?
157      lea     esi, [vendorAMD]      lea     esi, [vendorAMD]
158      lea     edi, [vendor]      lea     edi, [esp-12]
159      mov     ecx, 12      mov     ecx, 12
160      cld      cld
161      repe    cmpsb      repe    cmpsb
162      jnz     .cpu_quit      jnz     .cpu_quit
163    
164        ; 3DNow! support ?
165            CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, ebp
166    
167          ; 3DNOW extended ?          ; 3DNOW extended ?
168          CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, features          CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, ebp
169    
170          ; extended MMX ?          ; extended MMX ?
171          CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, features          CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, ebp
172    
173  .cpu_quit:  .cpu_quit:
174    
175          popad          mov eax, ebp
176    
177          mov eax, [features]          pop ebp
178            pop edi
179            pop esi
180            pop ebx
181    
182          ret          ret
183    
184    
185    
186    ; sse/sse2 operating support detection routines
187    ; these will trigger an invalid instruction signal if not supported.
188    
189    cglobal sse_os_trigger
190    align 16
191    sse_os_trigger:
192            xorps xmm0, xmm0
193            ret
194    
195    
196    cglobal sse2_os_trigger
197    align 16
198    sse2_os_trigger:
199            xorpd xmm0, xmm0
200            ret
201    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4