[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.6, Sat Jul 10 17:42:18 2004 UTC revision 1.11, Thu Mar 8 21:40:12 2007 UTC
# Line 27  Line 27 
27    
28  %macro cglobal 1  %macro cglobal 1
29          %ifdef PREFIX          %ifdef PREFIX
30                    %ifdef MARK_FUNCS
31                            global _%1:function %1.endfunc-%1
32                            %define %1 _%1:function %1.endfunc-%1
33                    %else
34                  global _%1                  global _%1
35                  %define %1 _%1                  %define %1 _%1
36                    %endif
37            %else
38                    %ifdef MARK_FUNCS
39                            global %1:function %1.endfunc-%1
40          %else          %else
41                  global %1                  global %1
42          %endif          %endif
43            %endif
44  %endmacro  %endmacro
45    
46  ;=============================================================================  ;=============================================================================
# Line 42  Line 51 
51  %define CPUID_MMX               0x00800000  %define CPUID_MMX               0x00800000
52  %define CPUID_SSE               0x02000000  %define CPUID_SSE               0x02000000
53  %define CPUID_SSE2              0x04000000  %define CPUID_SSE2              0x04000000
54    %define CPUID_SSE3              0x00000001
55    
56  %define EXT_CPUID_3DNOW         0x80000000  %define EXT_CPUID_3DNOW         0x80000000
57  %define EXT_CPUID_AMD_3DNOWEXT  0x40000000  %define EXT_CPUID_AMD_3DNOWEXT  0x40000000
# Line 52  Line 62 
62  %define XVID_CPU_MMXEXT   (1<< 1)  %define XVID_CPU_MMXEXT   (1<< 1)
63  %define XVID_CPU_SSE      (1<< 2)  %define XVID_CPU_SSE      (1<< 2)
64  %define XVID_CPU_SSE2     (1<< 3)  %define XVID_CPU_SSE2     (1<< 3)
65    %define XVID_CPU_SSE3     (1<< 8)
66  %define XVID_CPU_3DNOW    (1<< 4)  %define XVID_CPU_3DNOW    (1<< 4)
67  %define XVID_CPU_3DNOWEXT (1<< 5)  %define XVID_CPU_3DNOWEXT (1<< 5)
68  %define XVID_CPU_TSC      (1<< 6)  %define XVID_CPU_TSC      (1<< 6)
# Line 62  Line 73 
73    
74  ALIGN 32  ALIGN 32
75  %ifdef FORMAT_COFF  %ifdef FORMAT_COFF
76  SECTION .rodata data  SECTION .rodata
77  %else  %else
78  SECTION .rodata data align=16  SECTION .rodata align=16
79  %endif  %endif
80    
81  vendorAMD:  vendorAMD:
# Line 74  Line 85 
85  ; Macros  ; Macros
86  ;=============================================================================  ;=============================================================================
87    
88  %macro  CHECK_FEATURE         3  %macro  CHECK_FEATURE         4
89    mov ecx, %1    mov eax, %1
90    and ecx, edx    and eax, %4
91    neg ecx    neg eax
92    sbb ecx, ecx    sbb eax, eax
93    and ecx, %2    and eax, %2
94    or %3, ecx    or %3, eax
95  %endmacro  %endmacro
96    
97  ;=============================================================================  ;=============================================================================
# Line 131  Line 142 
142    cpuid    cpuid
143    
144   ; RDTSC command ?   ; RDTSC command ?
145    CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, ebp    CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, ebp, edx
146    
147    ; MMX support ?    ; MMX support ?
148    CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, ebp    CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, ebp, edx
149    
150    ; SSE support ?    ; SSE support ?
151    CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT|XVID_CPU_SSE), ebp    CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT|XVID_CPU_SSE), ebp, edx
152    
153    ; SSE2 support?    ; SSE2 support?
154    CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, ebp    CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, ebp, edx
155    
156      ; SSE3 support?
157      CHECK_FEATURE CPUID_SSE3, XVID_CPU_SSE3, ebp, ecx
158    
159    ; extended functions?    ; extended functions?
160    mov eax, 0x80000000    mov eax, 0x80000000
# Line 160  Line 174 
174    jnz .cpu_quit    jnz .cpu_quit
175    
176    ; 3DNow! support ?    ; 3DNow! support ?
177    CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, ebp    CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, ebp, edx
178    
179    ; 3DNOW extended ?    ; 3DNOW extended ?
180    CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, ebp    CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, ebp, edx
181    
182    ; extended MMX ?    ; extended MMX ?
183    CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, ebp    CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, ebp, edx
184    
185  .cpu_quit:  .cpu_quit:
186    
# Line 180  Line 194 
194    pop ebx    pop ebx
195    
196    ret    ret
197    .endfunc
198    
199  ; sse/sse2 operating support detection routines  ; sse/sse2 operating support detection routines
200  ; these will trigger an invalid instruction signal if not supported.  ; these will trigger an invalid instruction signal if not supported.
# Line 188  Line 203 
203  sse_os_trigger:  sse_os_trigger:
204    xorps xmm0, xmm0    xorps xmm0, xmm0
205    ret    ret
206    .endfunc
207    
208    
209  ALIGN 16  ALIGN 16
# Line 195  Line 211 
211  sse2_os_trigger:  sse2_os_trigger:
212    xorpd xmm0, xmm0    xorpd xmm0, xmm0
213    ret    ret
214    .endfunc
215    
216    
217  ; enter/exit mmx state  ; enter/exit mmx state
# Line 203  Line 220 
220  emms_mmx:  emms_mmx:
221    emms    emms
222    ret    ret
223    .endfunc
224    
225  ; faster enter/exit mmx state  ; faster enter/exit mmx state
226  ALIGN 16  ALIGN 16
# Line 210  Line 228 
228  emms_3dn:  emms_3dn:
229    femms    femms
230    ret    ret
231    .endfunc
232    
233    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.11

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