How can get the CPU unique ID?
-
Thanks
-
Thanks
Assuming the processor supports unique serial number:
#define cpuid __asm __emit 0fh __asm __emit 0a2h
UINT PSN, ID1, ID2, ID3;__asm
{
mov eax, 01H
cpuid
mov PSN, edx
}if (PSN&0x20000 0x40000) //Check bit 18 if serial number is available
{
__asm
{
mov eax, 01H
cpuid
mov ID1, eax
mov eax, 03H
cpuid
mov ID2, edx
mov ID3, ecx
}
}
else
{//Processor does not support unique ID
}If everything works out
ID1, ID2, ID3
should contain the unique 96 bit ID. I havn´t tested the code since I don´t have a PIII, but I hope it works... More info on cpuid here (pdf). Hope this helps /moliate -
Assuming the processor supports unique serial number:
#define cpuid __asm __emit 0fh __asm __emit 0a2h
UINT PSN, ID1, ID2, ID3;__asm
{
mov eax, 01H
cpuid
mov PSN, edx
}if (PSN&0x20000 0x40000) //Check bit 18 if serial number is available
{
__asm
{
mov eax, 01H
cpuid
mov ID1, eax
mov eax, 03H
cpuid
mov ID2, edx
mov ID3, ecx
}
}
else
{//Processor does not support unique ID
}If everything works out
ID1, ID2, ID3
should contain the unique 96 bit ID. I havn´t tested the code since I don´t have a PIII, but I hope it works... More info on cpuid here (pdf). Hope this helps /moliateThank you very much
-
Thank you very much