150 lines
3.2 KiB
HTML
150 lines
3.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of CPUID</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>CPUID</H1>
|
|
Section: Linux Programmer's Manual (4)<BR>Updated: 2019-08-02<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
cpuid - x86 CPUID access device
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
CPUID provides an interface for querying information about the x86 CPU.
|
|
<P>
|
|
|
|
This device is accessed by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+lseek">lseek</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pread">pread</A></B>(2)
|
|
|
|
to the appropriate CPUID level and reading in chunks of 16 bytes.
|
|
A larger read size means multiple reads of consecutive levels.
|
|
<P>
|
|
|
|
The lower 32 bits of the file position is used as the incoming
|
|
<I>%eax</I>,
|
|
|
|
and the upper 32 bits of the file position as the incoming
|
|
<I>%ecx</I>,
|
|
|
|
the latter intended for "counting"
|
|
<I>eax</I>
|
|
|
|
levels like
|
|
<I>eax=4</I>.
|
|
|
|
<P>
|
|
|
|
This driver uses
|
|
<I>/dev/cpu/CPUNUM/cpuid</I>,
|
|
|
|
where
|
|
<I>CPUNUM</I>
|
|
|
|
is the minor number,
|
|
and on an SMP box will direct the access to CPU
|
|
<I>CPUNUM</I>
|
|
|
|
as listed in
|
|
<I>/proc/cpuinfo</I>.
|
|
|
|
<P>
|
|
|
|
This file is protected so that it can be read only by the user
|
|
<I>root</I>,
|
|
|
|
or members of the group
|
|
<I>root</I>.
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The CPUID instruction can be directly executed by a program
|
|
using inline assembler.
|
|
However this device allows convenient
|
|
access to all CPUs without changing process affinity.
|
|
<P>
|
|
|
|
Most of the information in
|
|
<I>cpuid</I>
|
|
|
|
is reported by the kernel in cooked form either in
|
|
<I>/proc/cpuinfo</I>
|
|
|
|
or through subdirectories in
|
|
<I>/sys/devices/system/cpu</I>.
|
|
|
|
Direct CPUID access through this device should only
|
|
be used in exceptional cases.
|
|
<P>
|
|
|
|
The
|
|
<I>cpuid</I>
|
|
|
|
driver is not auto-loaded.
|
|
On modular kernels you might need to use the following command
|
|
to load it explicitly before use:
|
|
<P>
|
|
|
|
|
|
|
|
$ modprobe cpuid
|
|
|
|
|
|
<P>
|
|
|
|
There is no support for CPUID functions that require additional
|
|
input registers.
|
|
<P>
|
|
|
|
Very old x86 CPUs don't support CPUID.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+cpuid">cpuid</A></B>(1)
|
|
|
|
<P>
|
|
|
|
Intel Corporation, Intel 64 and IA-32 Architectures
|
|
Software Developer's Manual Volume 2A:
|
|
Instruction Set Reference, A-M, 3-180 CPUID reference.
|
|
<P>
|
|
|
|
Intel Corporation, Intel Processor Identification and
|
|
the CPUID Instruction, Application note 485.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">NOTES</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">SEE ALSO</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:01 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|