Parent Directory
|
Revision Log
Revision 1.2 - (view) (download)
1 : | Isibaar | 1.1 | ;/****************************************************************************** |
2 : | ; * * | ||
3 : | ; * This file is part of XviD, a free MPEG-4 video encoder/decoder * | ||
4 : | ; * * | ||
5 : | ; * XviD is an implementation of a part of one or more MPEG-4 Video tools * | ||
6 : | ; * as specified in ISO/IEC 14496-2 standard. Those intending to use this * | ||
7 : | ; * software module in hardware or software products are advised that its * | ||
8 : | ; * use may infringe existing patents or copyrights, and any such use * | ||
9 : | ; * would be at such party's own risk. The original developer of this * | ||
10 : | ; * software module and his/her company, and subsequent editors and their * | ||
11 : | ; * companies, will have no liability for use of this software or * | ||
12 : | ; * modifications or derivatives thereof. * | ||
13 : | ; * * | ||
14 : | ; * XviD is free software; you can redistribute it and/or modify it * | ||
15 : | ; * under the terms of the GNU General Public License as published by * | ||
16 : | ; * the Free Software Foundation; either version 2 of the License, or * | ||
17 : | ; * (at your option) any later version. * | ||
18 : | ; * * | ||
19 : | ; * XviD is distributed in the hope that it will be useful, but * | ||
20 : | ; * WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
21 : | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
22 : | ; * GNU General Public License for more details. * | ||
23 : | ; * * | ||
24 : | ; * You should have received a copy of the GNU General Public License * | ||
25 : | ; * along with this program; if not, write to the Free Software * | ||
26 : | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * | ||
27 : | ; * * | ||
28 : | ; ******************************************************************************/ | ||
29 : | ; | ||
30 : | ;/****************************************************************************** | ||
31 : | ; * * | ||
32 : | ; * cpuid.asm, check cpu features * | ||
33 : | ; * * | ||
34 : | ; * Copyright (C) 2001 - Michael Militzer <isibaar@xvid.org>, * | ||
35 : | ; * * | ||
36 : | ; * For more information visit the XviD homepage: http://www.xvid.org * | ||
37 : | ; * * | ||
38 : | ; ******************************************************************************/ | ||
39 : | ; | ||
40 : | ;/****************************************************************************** | ||
41 : | ; * * | ||
42 : | ; * Revision history: * | ||
43 : | ; * * | ||
44 : | ; * 17.12.2001 initial version (Isibaar) * | ||
45 : | ; * * | ||
46 : | ; ******************************************************************************/ | ||
47 : | |||
48 : | bits 32 | ||
49 : | |||
50 : | %define CPUID_TSC 0x00000010 | ||
51 : | %define CPUID_MMX 0x00800000 | ||
52 : | %define CPUID_SSE 0x02000000 | ||
53 : | %define CPUID_SSE2 0x04000000 | ||
54 : | |||
55 : | %define EXT_CPUID_3DNOW 0x80000000 | ||
56 : | %define EXT_CPUID_AMD_3DNOWEXT 0x40000000 | ||
57 : | %define EXT_CPUID_AMD_MMXEXT 0x00400000 | ||
58 : | |||
59 : | %define XVID_CPU_MMX 0x00000001 | ||
60 : | %define XVID_CPU_MMXEXT 0x00000002 | ||
61 : | %define XVID_CPU_SSE 0x00000004 | ||
62 : | %define XVID_CPU_SSE2 0x00000008 | ||
63 : | %define XVID_CPU_3DNOW 0x00000010 | ||
64 : | %define XVID_CPU_3DNOWEXT 0x00000020 | ||
65 : | %define XVID_CPU_TSC 0x00000040 | ||
66 : | |||
67 : | |||
68 : | suxen_drol | 1.2 | %macro cglobal 1 |
69 : | Isibaar | 1.1 | %ifdef PREFIX |
70 : | suxen_drol | 1.2 | global _%1 |
71 : | Isibaar | 1.1 | %define %1 _%1 |
72 : | %else | ||
73 : | global %1 | ||
74 : | %endif | ||
75 : | %endmacro | ||
76 : | |||
77 : | ALIGN 32 | ||
78 : | |||
79 : | section .data | ||
80 : | |||
81 : | vendorAMD db "AuthenticAMD" | ||
82 : | |||
83 : | %macro CHECK_FEATURE 3 | ||
84 : | |||
85 : | mov ecx, %1 | ||
86 : | and ecx, edx | ||
87 : | neg ecx | ||
88 : | sbb ecx, ecx | ||
89 : | and ecx, %2 | ||
90 : | suxen_drol | 1.2 | or %3, ecx |
91 : | Isibaar | 1.1 | |
92 : | %endmacro | ||
93 : | |||
94 : | section .text | ||
95 : | |||
96 : | ; int check_cpu_feature(void) | ||
97 : | |||
98 : | cglobal check_cpu_features | ||
99 : | check_cpu_features: | ||
100 : | suxen_drol | 1.2 | |
101 : | push ebx | ||
102 : | push esi | ||
103 : | push edi | ||
104 : | push ebp | ||
105 : | |||
106 : | xor ebp,ebp | ||
107 : | Isibaar | 1.1 | |
108 : | ; CPUID command ? | ||
109 : | suxen_drol | 1.2 | pushfd |
110 : | Isibaar | 1.1 | pop eax |
111 : | mov ecx, eax | ||
112 : | xor eax, 0x200000 | ||
113 : | push eax | ||
114 : | popfd | ||
115 : | pushfd | ||
116 : | pop eax | ||
117 : | cmp eax, ecx | ||
118 : | |||
119 : | jz near .cpu_quit ; no CPUID command -> exit | ||
120 : | |||
121 : | |||
122 : | ; get vendor string, used later | ||
123 : | xor eax, eax | ||
124 : | suxen_drol | 1.2 | cpuid |
125 : | mov [esp-12], ebx ; vendor string | ||
126 : | mov [esp-12+4], edx | ||
127 : | mov [esp-12+8], ecx | ||
128 : | Isibaar | 1.1 | test eax, eax |
129 : | |||
130 : | jz near .cpu_quit | ||
131 : | |||
132 : | suxen_drol | 1.2 | mov eax, 1 |
133 : | Isibaar | 1.1 | cpuid |
134 : | |||
135 : | ; RDTSC command ? | ||
136 : | suxen_drol | 1.2 | CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, ebp |
137 : | Isibaar | 1.1 | |
138 : | ; MMX support ? | ||
139 : | suxen_drol | 1.2 | CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, ebp |
140 : | Isibaar | 1.1 | |
141 : | ; SSE support ? | ||
142 : | suxen_drol | 1.2 | CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT|XVID_CPU_SSE), ebp |
143 : | Isibaar | 1.1 | |
144 : | ; SSE2 support? | ||
145 : | suxen_drol | 1.2 | CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, ebp |
146 : | Isibaar | 1.1 | |
147 : | ; extended functions? | ||
148 : | mov eax, 0x80000000 | ||
149 : | cpuid | ||
150 : | cmp eax, 0x80000000 | ||
151 : | jbe near .cpu_quit | ||
152 : | |||
153 : | mov eax, 0x80000001 | ||
154 : | cpuid | ||
155 : | |||
156 : | ; AMD cpu ? | ||
157 : | lea esi, [vendorAMD] | ||
158 : | suxen_drol | 1.2 | lea edi, [esp-12] |
159 : | Isibaar | 1.1 | mov ecx, 12 |
160 : | cld | ||
161 : | repe cmpsb | ||
162 : | jnz .cpu_quit | ||
163 : | |||
164 : | suxen_drol | 1.2 | ; 3DNow! support ? |
165 : | CHECK_FEATURE EXT_CPUID_3DNOW, XVID_CPU_3DNOW, ebp | ||
166 : | |||
167 : | Isibaar | 1.1 | ; 3DNOW extended ? |
168 : | suxen_drol | 1.2 | CHECK_FEATURE EXT_CPUID_AMD_3DNOWEXT, XVID_CPU_3DNOWEXT, ebp |
169 : | Isibaar | 1.1 | |
170 : | ; extended MMX ? | ||
171 : | suxen_drol | 1.2 | CHECK_FEATURE EXT_CPUID_AMD_MMXEXT, XVID_CPU_MMXEXT, ebp |
172 : | |||
173 : | .cpu_quit: | ||
174 : | |||
175 : | mov eax, ebp | ||
176 : | |||
177 : | pop ebp | ||
178 : | pop edi | ||
179 : | pop esi | ||
180 : | pop ebx | ||
181 : | |||
182 : | Isibaar | 1.1 | ret |
183 : | suxen_drol | 1.2 | |
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 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |