|
Packit |
7cfc04 |
.\" Copyright (c) 2009 Intel Corporation, Author Andi Kleen
|
|
Packit |
7cfc04 |
.\" Description based on comments in arch/x86/kernel/cpuid.c
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(VERBATIM)
|
|
Packit |
7cfc04 |
.\" Permission is granted to make and distribute verbatim copies of this
|
|
Packit |
7cfc04 |
.\" manual provided the copyright notice and this permission notice are
|
|
Packit |
7cfc04 |
.\" preserved on all copies.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Permission is granted to copy and distribute modified versions of this
|
|
Packit |
7cfc04 |
.\" manual under the conditions for verbatim copying, provided that the
|
|
Packit |
7cfc04 |
.\" entire resulting derived work is distributed under the terms of a
|
|
Packit |
7cfc04 |
.\" permission notice identical to this one.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
Packit |
7cfc04 |
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
Packit |
7cfc04 |
.\" responsibility for errors or omissions, or for damages resulting from
|
|
Packit |
7cfc04 |
.\" the use of the information contained herein. The author(s) may not
|
|
Packit |
7cfc04 |
.\" have taken the same level of care in the production of this manual,
|
|
Packit |
7cfc04 |
.\" which is licensed free of charge, as they might when working
|
|
Packit |
7cfc04 |
.\" professionally.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
Packit |
7cfc04 |
.\" the source, must acknowledge the copyright and authors of this work.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH CPUID 4 2009-03-31 "Linux" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
cpuid \- x86 CPUID access device
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
CPUID provides an interface for querying information about the x86 CPU.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
This device is accessed by
|
|
Packit |
7cfc04 |
.BR lseek (2)
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR pread (2)
|
|
Packit |
7cfc04 |
to the appropriate CPUID level and reading in chunks of 16 bytes.
|
|
Packit |
7cfc04 |
A larger read size means multiple reads of consecutive levels.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The lower 32 bits of the file position is used as the incoming
|
|
Packit |
7cfc04 |
.IR %eax ,
|
|
Packit |
7cfc04 |
and the upper 32 bits of the file position as the incoming
|
|
Packit |
7cfc04 |
.IR %ecx ,
|
|
Packit |
7cfc04 |
the latter intended for "counting"
|
|
Packit |
7cfc04 |
.I eax
|
|
Packit |
7cfc04 |
levels like
|
|
Packit |
7cfc04 |
.IR eax=4 .
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
This driver uses
|
|
Packit |
7cfc04 |
.IR /dev/cpu/CPUNUM/cpuid ,
|
|
Packit |
7cfc04 |
where
|
|
Packit |
7cfc04 |
.I CPUNUM
|
|
Packit |
7cfc04 |
is the minor number,
|
|
Packit |
7cfc04 |
and on an SMP box will direct the access to CPU
|
|
Packit |
7cfc04 |
.I CPUNUM
|
|
Packit |
7cfc04 |
as listed in
|
|
Packit |
7cfc04 |
.IR /proc/cpuinfo .
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
This file is protected so that it can be read only by the user
|
|
Packit |
7cfc04 |
.IR root ,
|
|
Packit |
7cfc04 |
or members of the group
|
|
Packit |
7cfc04 |
.IR root .
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
The CPUID instruction can be directly executed by a program
|
|
Packit |
7cfc04 |
using inline assembler.
|
|
Packit |
7cfc04 |
However this device allows convenient
|
|
Packit |
7cfc04 |
access to all CPUs without changing process affinity.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Most of the information in
|
|
Packit |
7cfc04 |
.I cpuid
|
|
Packit |
7cfc04 |
is reported by the kernel in cooked form either in
|
|
Packit |
7cfc04 |
.I /proc/cpuinfo
|
|
Packit |
7cfc04 |
or through subdirectories in
|
|
Packit |
7cfc04 |
.IR /sys/devices/system/cpu .
|
|
Packit |
7cfc04 |
Direct CPUID access through this device should only
|
|
Packit |
7cfc04 |
be used in exceptional cases.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.I cpuid
|
|
Packit |
7cfc04 |
driver is not auto-loaded.
|
|
Packit |
7cfc04 |
On modular kernels you might need to use the following command
|
|
Packit |
7cfc04 |
to load it explicitly before use:
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.in +4n
|
|
Packit |
7cfc04 |
.EX
|
|
Packit |
7cfc04 |
$ modprobe cpuid
|
|
Packit |
7cfc04 |
.EE
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
There is no support for CPUID functions that require additional
|
|
Packit |
7cfc04 |
input registers.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Very old x86 CPUs don't support CPUID.
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
Intel Corporation, Intel 64 and IA-32 Architectures
|
|
Packit |
7cfc04 |
Software Developer's Manual Volume 2A:
|
|
Packit |
7cfc04 |
Instruction Set Reference, A-M, 3-180 CPUID reference.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Intel Corporation, Intel Processor Identification and
|
|
Packit |
7cfc04 |
the CPUID Instruction, Application note 485.
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|