[svn] / branches / dev-api-4 / xvidcore / src / utils / x86_asm / cpuid.asm Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/utils/x86_asm/cpuid.asm

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

trunk/xvidcore/src/utils/x86_asm/cpuid.asm revision 3, Fri Mar 8 02:46:11 2002 UTC branches/dev-api-4/xvidcore/src/utils/x86_asm/cpuid.asm revision 1176, Thu Oct 9 18:50:22 2003 UTC
# Line 56  Line 56 
56  %define EXT_CPUID_AMD_3DNOWEXT  0x40000000  %define EXT_CPUID_AMD_3DNOWEXT  0x40000000
57  %define EXT_CPUID_AMD_MMXEXT    0x00400000  %define EXT_CPUID_AMD_MMXEXT    0x00400000
58    
59  %define XVID_CPU_MMX                    0x00000001  %define XVID_CPU_MMX      (1<< 0)
60  %define XVID_CPU_MMXEXT                 0x00000002  %define XVID_CPU_MMXEXT   (1<< 1)
61  %define XVID_CPU_SSE            0x00000004  %define XVID_CPU_SSE      (1<< 2)
62  %define XVID_CPU_SSE2                   0x00000008  %define XVID_CPU_SSE2     (1<< 3)
63  %define XVID_CPU_3DNOW          0x00000010  %define XVID_CPU_3DNOW    (1<< 4)
64  %define XVID_CPU_3DNOWEXT               0x00000020  %define XVID_CPU_3DNOWEXT (1<< 5)
65  %define XVID_CPU_TSC            0x00000040  %define XVID_CPU_TSC      (1<< 6)
   
66    
67  %macro cglobal 1  %macro cglobal 1
68          %ifdef PREFIX          %ifdef PREFIX
# Line 78  Line 77 
77    
78  section .data  section .data
79    
 features        dd 0  
   
 vendor          dd 0,0,0  
80  vendorAMD       db "AuthenticAMD"  vendorAMD       db "AuthenticAMD"
81    
82  %macro  CHECK_FEATURE         3  %macro  CHECK_FEATURE         3
# Line 90  Line 86 
86      neg     ecx      neg     ecx
87      sbb     ecx, ecx      sbb     ecx, ecx
88      and     ecx, %2      and     ecx, %2
89      or      [%3], ecx      or      %3, ecx
90    
91  %endmacro  %endmacro
92    
# Line 101  Line 97 
97  cglobal check_cpu_features  cglobal check_cpu_features
98  check_cpu_features:  check_cpu_features:
99    
100          pushad          push ebx
101          pushfd          push esi
102            push edi
103            push ebp
104    
105            xor ebp,ebp
106    
107          ; CPUID command ?          ; CPUID command ?
108            pushfd
109          pop             eax          pop             eax
110          mov             ecx, eax          mov             ecx, eax
111          xor             eax, 0x200000          xor             eax, 0x200000
# Line 120  Line 121 
121          ; get vendor string, used later          ; get vendor string, used later
122      xor     eax, eax      xor     eax, eax
123      cpuid      cpuid
124      mov     [vendor], ebx       ; vendor string      mov     [esp-12], ebx       ; vendor string
125      mov     [vendor+4], edx      mov     [esp-12+4], edx
126      mov     [vendor+8], ecx      mov     [esp-12+8], ecx
127      test    eax, eax      test    eax, eax
128    
129      jz      near .cpu_quit      jz      near .cpu_quit
# Line 130  Line 131 
131      mov     eax, 1      mov     eax, 1
132      cpuid      cpuid
133    
   
134      ; RDTSC command ?      ; RDTSC command ?
135          CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, features          CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, ebp
136    
137      ; MMX support ?      ; MMX support ?
138          CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, features          CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, ebp
139    
140      ; SSE support ?      ; SSE support ?
141          CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT+XVID_CPU_SSE), features          CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT|XVID_CPU_SSE), ebp
142    
143          ; SSE2 support?          ; SSE2 support?
144          CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, features          CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, ebp
   
145    
146          ; extended functions?          ; extended functions?
147      mov     eax, 0x80000000      mov     eax, 0x80000000
# Line 153  Line 152 
152      mov     eax, 0x80000001      mov     eax, 0x80000001
153      cpuid      cpuid
154    
     ; 3DNow! support ?  
         CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, features  
   
155          ; AMD cpu ?          ; AMD cpu ?
156      lea     esi, [vendorAMD]      lea     esi, [vendorAMD]
157      lea     edi, [vendor]      lea     edi, [esp-12]
158      mov     ecx, 12      mov     ecx, 12
159      cld      cld
160      repe    cmpsb      repe    cmpsb
161      jnz     .cpu_quit      jnz     .cpu_quit
162    
163        ; 3DNow! support ?
164            CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, ebp
165    
166          ; 3DNOW extended ?          ; 3DNOW extended ?
167          CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, features          CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, ebp
168    
169          ; extended MMX ?          ; extended MMX ?
170          CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, features          CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, ebp
171    
172  .cpu_quit:  .cpu_quit:
173    
174          popad          mov eax, ebp
175    
176            pop ebp
177            pop edi
178            pop esi
179            pop ebx
180    
181            ret
182    
183    
184    
185    ; sse/sse2 operating support detection routines
186    ; these will trigger an invalid instruction signal if not supported.
187    
188    cglobal sse_os_trigger
189    align 16
190    sse_os_trigger:
191            xorps xmm0, xmm0
192            ret
193    
194    
195    cglobal sse2_os_trigger
196    align 16
197    sse2_os_trigger:
198            xorpd xmm0, xmm0
199            ret
200    
201    
202    ; enter/exit mmx state
203    
204    cglobal emms_mmx
205    align 16
206    emms_mmx:
207            emms
208            ret
209    
210          mov eax, [features]  ; faster enter/exit mmx state
211    
212    cglobal emms_3dn
213    align 16
214    emms_3dn:
215            femms
216          ret          ret

Legend:
Removed from v.3  
changed lines
  Added in v.1176

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