#ifndef CPU_SUPPORT_H # define CPU_SUPPORT_H #define CPU_SUPPORTS_CPUID (0x00000001L) #define CPU_SUPPORTS_FPU (0x00000002L) #define CPU_SUPPORTS_MMX (0x00000004L) #define CPU_SUPPORTS_INTEGER_SSE (0x00000008L) #define CPU_SUPPORTS_SSE (0x00000010L) #define CPU_SUPPORTS_SSE2 (0x00000020L) #define CPU_SUPPORTS_3DNOW (0x00000040L) #define CPU_SUPPORTS_3DNOW_EXT (0x00000080L) long cpugetsupportedextensions (); #ENDIF --------------------------------------- -------------------------------------------------- --------------------- # include
Features Register EXISTS, LOOK for MMX, SSE, SSE2. MOV EAX, 1 CPUID MOV EBX, EDX AND EBX, 00800000H; MMX IS Bit 23 SHR EBX, 21 or EBP, EBX; SET BIT 2 IF MMX EXISTS MOV EBX, EDX AND EDX, 02000000H; SSE IS BIT 25 SHR EDX, 25 NEG EDX AND EDX, 00000018H; SET BITS 3 and 4 if SSE EXISTS or EBP, EDX AND EBX, 04000000H; SSE2 IS Bit 26 SHR EBX, 21 and EBX, 00000020H; SET bit 5 or ebp, ebx; check for vendor feature register (K6 / Athlon) mov eax, 80000000h cpuid mov ecx, 80000001h cmp eax, ecx jb done;. vendor feature register exists, look for 3DNow and Athlon extensions mov eax, ecx! CPUID MOV EAX, EDX AND EDX, 80000000H; 3DNOW! IS Bit 31 SHR EDX, 25 or EBP, EDX; SET BIT 6 MOV EDX, EAX and Eax, 40000000H; 3DNOW! 2 IS Bit 30 SHR EAX, 23 or EBP, EBP, EBP SET BIT 7 and EDX, 00400000H; AMD MMX Extensions (Integer SSE) IS Bit 22 SHR EDX, 19 or EBP, EDX DONE: MOV EAX, EBP MOV G_LCPUEXTENSIONSAVAILABLE, EBP; Full SSE and SSE-2 Require OS Support for Test Eax, 00000030h JZ Nocheck Call CpuCheckforssesupportnocheck: Pop Ebx Pop ESI POP EDI POP EBP RET}} Author BLOG:
http://blog.9cbs.net/firetoucher/
related articles
Fast Memory Copy Code CPU Support Code Wide Band Delphi Estimation Process VI Command List Intercepting and Managing Windows