home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 1998 April / Freeware-CD.bin / cputst / amd_cpu / amd!.EXE / CHKCPUID.CPP next >
Encoding:
C/C++ Source or Header  |  1996-12-19  |  1.2 KB  |  61 lines

  1. /*     $Archive: /General Utilities/CPUID/chkcpuid.cpp $
  2.     $Author : $
  3.     $Date   : $
  4.     $Header : $
  5.     $History: chkcpuid.cpp $
  6.  * 
  7.  * *****************  Version 2  *****************
  8.  * User: Tanb         Date: 7/18/96    Time: 4:47p
  9.  * Updated in $/General Utilities/CPUID
  10.  * Make the display look better.
  11.  */
  12.  
  13.  
  14. #include "DEFINES.H"
  15. #include <iomanip.h>
  16. #include <iostream.h>
  17. #include <conio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20.  
  21. //chkdpuid identifies the processor name string.
  22.  
  23. int cpuid::chkcpuid()
  24. {
  25.   char idstr[13];             //vendor string variable
  26.   
  27.  
  28.   asm {
  29.        mov    eax,0x0        //EAX = 0
  30.        db     0x0F,0xA2      //CPUID opcode
  31.   }
  32.   //store the 12 character ASCII string
  33.   idstr[0] = _BL;            
  34.   idstr[1] = _BH;            
  35.   asm {                      
  36.       ror ebx,0x10
  37.   }
  38.   idstr[2] = _BL;
  39.   idstr[3] = _BH;
  40.   idstr[4] = _DL;
  41.   idstr[5] = _DH;
  42.   asm {
  43.       ror edx,0x10        
  44.   }
  45.   idstr[6] = _DL;
  46.   idstr[7] = _DH;
  47.   idstr[8] = _CL;
  48.   idstr[9] = _CH;
  49.   asm {
  50.        ror  ecx,0x10
  51.   }
  52.   idstr[10] = _CL;
  53.   idstr[11] = _CH;
  54.   idstr[12] = '\0';
  55.  
  56.   if ( strcmp(idstr, "AuthenticAMD") != 0 )
  57.      return (0);
  58.   else
  59.      return (1);
  60. }
  61.