R&D/OS

[2/4] find CPUID in assembly

sunshout 2013. 3. 22. 18:13

1. Source Build


svn co http://sunshout.googlecode.com/svn/trunk/os/cpuid cpuid


cd cpuid

make



2. Test


Basic Usage


 2.1 print usage


./cpuid -h


[root@tesla-xen cpuid]# ./cpuid -h

Usage: cpuid -[h|b|f|s]

Options:

 -h print help

 -b print cpu brand

 -f <eax> print standard CPUID functions

 -s print cpu signature



 2.2 print CPU branch


./cpuid -b

[root@tesla-xen cpuid]# ./cpuid -b

GenuineIntel


 2.3 print CPU flags


./cpuid -s



 2.4 print CPU register value (eax,ebx,ecx,edx)


./cpuid -f <eax register value>


This option shows raw values of eax, ebx, ecx, and edx register.


example

To check Architectural Performance Monitor Feature (Function 0Ah)

./cpuid -f 10   (since hex 0xA is integer 10.)


[root@tesla-xen cpuid]# ./cpuid -f 10

EAX:00000111001100000000010000000011

EBX:00000000000000000000000000000000

ECX:00000000000000000000000000000000

EDX:00000000000000000000011000000011



Reference

[1] Intel Processor Identification and the CPUID Instruction