Curiosity ...

In WDK documentation, I’ve seen CPUID referenced, but only for the
Hypervisor. __cpuid is documented but it looks like it’s user mode only. Is
there a way to acquire the cpuid in the kernel?

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

Gary G. Little wrote:

In WDK documentation, I’ve seen CPUID referenced, but only for the
Hypervisor. __cpuid is documented but it looks like it’s user mode only. Is
there a way to acquire the cpuid in the kernel?

__cpuid is an intrisic. It compiles to a single CPU instruction. It
works regardless of CPU mode.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks Tim. Have you ever used it in the kernel?

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, September 07, 2010 2:35 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Curiosity …

Gary G. Little wrote:

In WDK documentation, I’ve seen CPUID referenced, but only for the
Hypervisor. __cpuid is documented but it looks like it’s user mode
only. Is there a way to acquire the cpuid in the kernel?

__cpuid is an intrisic. It compiles to a single CPU instruction. It works
regardless of CPU mode.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

If applicable, I would use kernel APIs such as ExIsProcessorFeaturePresent instead of raw cpuid (which is somewhat unwieldy).

  • S

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
Sent: Tuesday, September 07, 2010 12:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Curiosity …

In WDK documentation, I’ve seen CPUID referenced, but only for the Hypervisor. __cpuid is documented but it looks like it’s user mode only. Is there a way to acquire the cpuid in the kernel?

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Gary G. Little wrote:

Thanks Tim. Have you ever used it in the kernel?

I don’t recall. I have certainly used __readtsc, __readmsr, and
__writemsr, and __cpuid is less demanding than any of those.

Really, there’s nothing to go wrong. The __cpuid intrinsic really does
compile inline to a single CPU instruction (modulo saving the registers
it dirties). The cpuid instruction is certainly valid in kernel mode.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Gary - We use it in the kernel without issue.

Sure. However, it seems I will need my customer to pass it to the kernel
since he requires it be tokenized using an MD5 hash. So … he can get it
too, hash it, and then pass me the hashed version. :slight_smile:

Thanks for the information.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, September 07, 2010 5:23 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Curiosity …

Gary G. Little wrote:

Thanks Tim. Have you ever used it in the kernel?

I don’t recall. I have certainly used __readtsc, __readmsr, and __writemsr,
and __cpuid is less demanding than any of those.

Really, there’s nothing to go wrong. The __cpuid intrinsic really does
compile inline to a single CPU instruction (modulo saving the registers it
dirties). The cpuid instruction is certainly valid in kernel mode.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer