1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH CPUID 7D "April 9, 2016"
7 .SH NAME
8 cpuid \- CPU identification driver
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB/dev/cpu/self/cpuid\fR
13 .fi
14
15 .SH DESCRIPTION
16 .SS "SPARC and x86 system"
17 .LP
18 This device provides implementation-private information via ioctls about
19 various aspects of the implementation to Solaris libraries and utilities.
20 .SS "x86 systems only"
21 .LP
22 This device also provides a file-like view of the namespace and return values
26 configuration of the processor.
27 .LP
28 The API for the character device consists of using the seek offset to set the
29 function code value, and using a \fBread\fR(2) or \fBpread\fR(2) of 16 bytes to
30 fetch the four 32-bit return values of the instruction in the order %\fBeax\fR,
31 %\fBebx\fR, %\fBecx\fR and %\fBedx\fR.
32 .LP
33 No data can be written to the device. Like the \fBcpuid\fR instruction, no
34 special privileges are required to use the device.
35 .LP
36 The device is useful to enable low-level configuration information to be
37 extracted from the CPU without having to write any assembler code to invoke the
38 \fBcpuid\fR instruction directly. It also allows the kernel to attempt to
39 correct any erroneous data returned by the instruction (prompted by occasional
40 errors in the information exported by various processor implementations over
41 the years).
42 .LP
43 See the processor manufacturers documentation for further information about the
44 syntax and semantics of the wide variety of information available from this
45 instruction.
46 .SH EXAMPLE
47 .LP
48 This example allows you to determine if the current x86 processor supports
49 "long mode," which is a necessary (but not sufficient) condition for running
50 the 64-bit Solaris kernel on the processor.
51 .sp
52 .in +2
53 .nf
54 /*
55
56 #include <sys/types.h>
57 #include <sys/stat.h>
58 #include <fcntl.h>
59 #include <unistd.h>
60 #include <string.h>
61 #include <errno.h>
62 #include <stdio.h>
63
64 static const char devname[] = "/dev/cpu/self/cpuid";
65
|
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 2015, Joyent, Inc.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH CPUID 7D "April 9, 2016"
8 .SH NAME
9 cpuid \- CPU identification driver
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fB/dev/cpu/self/cpuid\fR
14 .fi
15
16 .SH DESCRIPTION
17 .SS "SPARC and x86 system"
18 .LP
19 This device provides implementation-private information via ioctls about
20 various aspects of the implementation to Solaris libraries and utilities.
21 .SS "x86 systems only"
22 .LP
23 This device also provides a file-like view of the namespace and return values
27 configuration of the processor.
28 .LP
29 The API for the character device consists of using the seek offset to set the
30 function code value, and using a \fBread\fR(2) or \fBpread\fR(2) of 16 bytes to
31 fetch the four 32-bit return values of the instruction in the order %\fBeax\fR,
32 %\fBebx\fR, %\fBecx\fR and %\fBedx\fR.
33 .LP
34 No data can be written to the device. Like the \fBcpuid\fR instruction, no
35 special privileges are required to use the device.
36 .LP
37 The device is useful to enable low-level configuration information to be
38 extracted from the CPU without having to write any assembler code to invoke the
39 \fBcpuid\fR instruction directly. It also allows the kernel to attempt to
40 correct any erroneous data returned by the instruction (prompted by occasional
41 errors in the information exported by various processor implementations over
42 the years).
43 .LP
44 See the processor manufacturers documentation for further information about the
45 syntax and semantics of the wide variety of information available from this
46 instruction.
47 .LP
48 Some systems can be configured to limit the cpuid opcodes which are accessible.
49 While illumos handles this condition, other software may malfunction when such
50 limits are enabled. Those settings are typically manipulated in the BIOS.
51 .SH EXAMPLE
52 .LP
53 This example allows you to determine if the current x86 processor supports
54 "long mode," which is a necessary (but not sufficient) condition for running
55 the 64-bit Solaris kernel on the processor.
56 .sp
57 .in +2
58 .nf
59 /*
60
61 #include <sys/types.h>
62 #include <sys/stat.h>
63 #include <fcntl.h>
64 #include <unistd.h>
65 #include <string.h>
66 #include <errno.h>
67 #include <stdio.h>
68
69 static const char devname[] = "/dev/cpu/self/cpuid";
70
|