[geeks] generating unique systemids

Jonathan C. Patschke jp at celestrion.net
Mon Aug 27 14:23:43 CDT 2007


On Mon, 27 Aug 2007, Phil Brutsche wrote:

> IIRC all PIII and newer Intel CPUs - including the Xeon variants -
> have a hard-coded unique ID in the form of a processor serial number.
>
> Most of the time it's disabled by default in the BIOS.

I haven't seen that option in a lot of recent PC firmwares.  but, the
easy way to check is to check bit 18 of the Feature Flags:

         mov eax, 1
         cpuid

Bit 18 of EDX will be set to 1 if the CPU supports the serial number and
the serial number has not been previously disabled (an OS kernel can do
it as easily as the firmware).  Then, to read it:

         mov eax, 3
         cpuid

EDX will contain bits 63 - 32 of the processor serial number, and ECX
will contain bits 31 - 0 of the processor serial number.  Intel
considers the processor signature (EAX from the first cpuid call) to be
bits 95 - 64 of the processor serial number, but, in practice, the lower
64 bits provide plenty of space to avoid collisions.

VIA CPUs do things the Intel way, AMD doesn't do it at all, and
Transmeta CPUs use the EBX register (with an additional 32 bits of
serial number in EAX for the Efficien line of CPUs).

If you don't have any AMD CPUs, it's easy to cobble together a tiny app
to do this with gcc and the inline assembler in a truly trivial amount
of time.  If you do have AMD CPUs, well, you'll have to use some other
set of metrics.

It's worth noting that the Intel application note for the procesor
serial number says "Do not assume processor serial number is a unique
number without further qualifiers," which is pretty puzzling.

-- 
Jonathan Patschke     )
Elgin, TX            (      "I detest logging filesystems."
USA                   )                    --Linus Torvalds



More information about the geeks mailing list