Inconsistent CPUID result
From: babel2017 (babel2017_at_aol.com)
Date: 02/15/04
- Next message: Nudge: "Re: Divide by constant"
- Previous message: Phil Carmody: "Re: Help:Divide overflow error"
- Next in thread: Andreas Groegel: "Re: Inconsistent CPUID result"
- Reply: Andreas Groegel: "Re: Inconsistent CPUID result"
- Reply: Michael Brown: "Re: Inconsistent CPUID result"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Nudge: "Re: Divide by constant"
- Previous message: Phil Carmody: "Re: Help:Divide overflow error"
- Next in thread: Andreas Groegel: "Re: Inconsistent CPUID result"
- Reply: Andreas Groegel: "Re: Inconsistent CPUID result"
- Reply: Michael Brown: "Re: Inconsistent CPUID result"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|