Inconsistent CPUID result

From: babel2017 (babel2017_at_aol.com)
Date: 02/15/04


Date: Sun, 15 Feb 2004 09:38:31 +0000 (UTC)

Hi

I use a machine fingerprint for license control. Have just introduced
CPUID into the mix and it's out for testing. One tester's CPU
suddenly decided to change its name! It was "AMD Athlon(tm)
Processor" and now it's "AMD Athlon(tm) XP 3000+"! Any clues as to
why this happened and whether it's possible to get consistent results
from CPUID? Here's my code (Delphi7 environment). TIA.

function TCertificate.CPUInfo : string;
    function CPUIDAvail : boolean; assembler;
    asm
      pushfd // get flags into ax
      pop eax // save a copy on the stack
      mov edx,eax
      xor eax, 0200000h // flip bit 21
      push eax // load new value into flags
      popfd // get them back
      pushfd
      pop eax
      xor eax,edx
      and eax, 0200000h // clear all but bit 21
      shr eax, 21
    end;
var
  s:array[0..48] of char;
begin
  fillchar(s,sizeof(s),0);
  if CPUIDAvail then begin
    asm
      //save regs
      push ebx
      push ecx
      push edx
      //check level of CPUID calls supported
      mov eax,080000000h
      CPUID
      cmp eax,080000004h
      jae @@third
      cmp eax,080000003h
      je @@second
      cmp eax,080000002h
      je @@first
      jmp @@endbrandstr
      //get third name part
    @@third:
      mov eax,080000004h
      CPUID
      mov longword(s[32]),eax
      mov longword(s[36]),ebx
      mov longword(s[40]),ecx
      mov longword(s[44]),edx
      //get second name part
    @@second:
      mov eax,080000003h
      CPUID
      mov longword(s[16]),eax
      mov longword(s[20]),ebx
      mov longword(s[24]),ecx
      mov longword(s[28]),edx
      //get first name part
    @@first:
      mov eax,080000002h
      CPUID
      mov longword(s[0]),eax
      mov longword(s[4]),ebx
      mov longword(s[8]),ecx
      mov longword(s[12]),edx
    @@endbrandstr:
      //restore regs
      pop edx
      pop ecx
      pop ebx
     end;
   end;
   result:=trim(StrPas(s));
end;

Julian Brewer



Relevant Pages

  • Re: GetCurrentProcessorNumber() for XP?
    ... You would set the affinity for each processor in sequence to build a mapping ... Then, later, when you execute cpuid on a thread with multiprocessor ... I think the problem being discussed (custom CPU meter ...
    (microsoft.public.win32.programmer.kernel)
  • Re: 2.6.28 boot fails on Cyrix 6x86
    ... Enabling CPUID on Cyrix processor. ... 45680k/49152k available (1557k kernel code, 3084k reserved, ... CPU: Cyrix 6x86 2x Core/Bus Clock stepping 05 ...
    (Linux-Kernel)
  • 2.6.28 boot fails on Cyrix 6x86
    ... UMC UMC UMC UMC ... Enabling CPUID on Cyrix processor. ... CPU: Cyrix 6x86 2x Core/Bus Clock stepping 05 ...
    (Linux-Kernel)
  • Re: 2.6.28 boot fails on Cyrix 6x86
    ... UMC UMC UMC UMC ... Enabling CPUID on Cyrix processor. ... CPU: Cyrix 6x86 2x Core/Bus Clock stepping 05 ...
    (Linux-Kernel)
  • Re: Inconsistent CPUID result
    ... >> CPUID into the mix and it's out for testing. ... > The name string is user-configurable. ... my BIOS initializes my first CPU's name string to ... "AMD AthlonMP 1600+" second CPU's name string to "AMD Athlon ...
    (comp.lang.asm.x86)