You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.adoc
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12506,6 +12506,44 @@ Generated some polemic when kernel devs wanted to use it as part of `/dev/random
12506
12506
12507
12507
RDRAND sets the carry flag when data is ready so we must loop if the carry flag isn't set.
12508
12508
12509
+
==== x86 CPUID instruction
12510
+
12511
+
Example: link:userland/arch/x86_64/cpuid.S[CPUID]
12512
+
12513
+
Fills EAX, EBX, ECX and EDX with CPU information.
12514
+
12515
+
The exact data to show depends on the value of EAX, and for a few cases instructions ECX. When it depends on ECX, it is called a sub-leaf. Out test program prints `eax == 0`.
12516
+
12517
+
On <<p51>> for example the output EAX, EBX, ECX and EDX are:
12518
+
12519
+
....
12520
+
0x00000016
12521
+
0x756E6547
12522
+
0x6C65746E
12523
+
0x49656E69
12524
+
....
12525
+
12526
+
EBX and ECX are easy to interpret:
12527
+
12528
+
* EBX: 75 6e 65 47 == 'u', 'n', 'e', 'G' in ASCII
12529
+
* ECX: 6C 65 74 6E == 'l', 'e', 't', 'n'
12530
+
12531
+
so we see the string `Genu ntel` which is a shorthand for "Genuine Intel". Ha, I wonder if they had serious CPU pirating problems in the past? :-)
12532
+
12533
+
Information available includes:
12534
+
12535
+
* vendor
12536
+
* version
12537
+
* features (mmx, simd, rdrand, etc.) <http://en.wikipedia.org/wiki/CPUID# EAX.3D1:_Processor_Info_and_Feature_Bits>
The cool thing about this instruction is that it allows you to check the CPU specs and take alternative actions based on that inside your program.
12542
+
12543
+
On Linux, the capacity part of this information is parsed and made available at `cat /proc/cpuinfo`. See: http://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
12544
+
12545
+
There is also the `cpuinfo` command line tool that parses the CPUID instruction from the command line. Source: http://www.etallen.com/cpuid.html
0 commit comments