| @@ -1,523 +1,523 @@ | | | @@ -1,523 +1,523 @@ |
1 | /* $NetBSD: procfs_machdep.c,v 1.15.2.4 2018/03/16 13:08:14 martin Exp $ */ | | 1 | /* $NetBSD: procfs_machdep.c,v 1.15.2.5 2018/06/09 15:14:49 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2001 Wasabi Systems, Inc. | | 4 | * Copyright (c) 2001 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Frank van der Linden and Jason R. Thorpe for | | 7 | * Written by Frank van der Linden and Jason R. Thorpe for |
8 | * Wasabi Systems, Inc. | | 8 | * Wasabi Systems, Inc. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright | | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | | 16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | | 17 | * documentation and/or other materials provided with the distribution. |
18 | * 3. All advertising materials mentioning features or use of this software | | 18 | * 3. All advertising materials mentioning features or use of this software |
19 | * must display the following acknowledgement: | | 19 | * must display the following acknowledgement: |
20 | * This product includes software developed for the NetBSD Project by | | 20 | * This product includes software developed for the NetBSD Project by |
21 | * Wasabi Systems, Inc. | | 21 | * Wasabi Systems, Inc. |
22 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse | | 22 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse |
23 | * or promote products derived from this software without specific prior | | 23 | * or promote products derived from this software without specific prior |
24 | * written permission. | | 24 | * written permission. |
25 | * | | 25 | * |
26 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND | | 26 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND |
27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
36 | * POSSIBILITY OF SUCH DAMAGE. | | 36 | * POSSIBILITY OF SUCH DAMAGE. |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | /* | | 39 | /* |
40 | * NOTE: We simply use the primary CPU's cpuid_level and tsc_freq | | 40 | * NOTE: We simply use the primary CPU's cpuid_level and tsc_freq |
41 | * here. Might want to change this later. | | 41 | * here. Might want to change this later. |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <sys/cdefs.h> | | 44 | #include <sys/cdefs.h> |
45 | __KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.4 2018/03/16 13:08:14 martin Exp $"); | | 45 | __KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.5 2018/06/09 15:14:49 martin Exp $"); |
46 | | | 46 | |
47 | #include <sys/param.h> | | 47 | #include <sys/param.h> |
48 | #include <sys/systm.h> | | 48 | #include <sys/systm.h> |
49 | #include <sys/mount.h> | | 49 | #include <sys/mount.h> |
50 | #include <sys/stat.h> | | 50 | #include <sys/stat.h> |
51 | #include <sys/vnode.h> | | 51 | #include <sys/vnode.h> |
52 | | | 52 | |
53 | #include <miscfs/procfs/procfs.h> | | 53 | #include <miscfs/procfs/procfs.h> |
54 | | | 54 | |
55 | #include <machine/cpu.h> | | 55 | #include <machine/cpu.h> |
56 | #include <machine/reg.h> | | 56 | #include <machine/reg.h> |
57 | #include <machine/specialreg.h> | | 57 | #include <machine/specialreg.h> |
58 | #include <x86/cputypes.h> | | 58 | #include <x86/cputypes.h> |
59 | #include <x86/cpuvar.h> | | 59 | #include <x86/cpuvar.h> |
60 | | | 60 | |
61 | /* | | 61 | /* |
62 | * The feature table. The order is the same as Linux's | | 62 | * The feature table. The order is the same as Linux's |
63 | * x86/include/asm/cpufeatures.h. | | 63 | * x86/include/asm/cpufeatures.h. |
64 | */ | | 64 | */ |
65 | static const char * const x86_features[][32] = { | | 65 | static const char * const x86_features[][32] = { |
66 | { /* (0) Common: 0x0000001 edx */ | | 66 | { /* (0) Common: 0x0000001 edx */ |
67 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | | 67 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", |
68 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | | 68 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", |
69 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | | 69 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", |
70 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe"}, | | 70 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe"}, |
71 | | | 71 | |
72 | { /* (1) AMD-defined: 0x80000001 edx */ | | 72 | { /* (1) AMD-defined: 0x80000001 edx */ |
73 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 73 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
74 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | | 74 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, |
75 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | | 75 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, |
76 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext","3dnow"}, | | 76 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext","3dnow"}, |
77 | | | 77 | |
78 | { /* (2) Transmeta-defined */ | | 78 | { /* (2) Transmeta-defined */ |
79 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | | 79 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, |
80 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 80 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
81 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 81 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
82 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 82 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
83 | | | 83 | |
84 | { /* (3) Linux mapping */ | | 84 | { /* (3) Linux mapping */ |
85 | "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL, | | 85 | "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL, |
86 | "constant_tsc", NULL, NULL, | | 86 | "constant_tsc", NULL, NULL, |
87 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 87 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
88 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 88 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
89 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 89 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
90 | | | 90 | |
91 | { /* (4) Intel-defined: 0x00000001 ecx */ | | 91 | { /* (4) Intel-defined: 0x00000001 ecx */ |
92 | "pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est", | | 92 | "pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est", |
93 | "tm2", "ssse3", "cid", "sdbg", "fma", "cx16", "xtpr", "pdcm", | | 93 | "tm2", "ssse3", "cid", "sdbg", "fma", "cx16", "xtpr", "pdcm", |
94 | NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt", | | 94 | NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt", |
95 | "tsc_deadline_timer", "aes", "xsave", NULL, | | 95 | "tsc_deadline_timer", "aes", "xsave", NULL, |
96 | "avx", "f16c", "rdrand", "hypervisor"}, | | 96 | "avx", "f16c", "rdrand", "hypervisor"}, |
97 | | | 97 | |
98 | { /* (5) VIA/Cyrix/Centaur-defined */ | | 98 | { /* (5) VIA/Cyrix/Centaur-defined */ |
99 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | | 99 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", |
100 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | | 100 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, |
101 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 101 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
102 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 102 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
103 | | | 103 | |
104 | { /* (6) AMD defined 80000001 ecx */ | | 104 | { /* (6) AMD defined 80000001 ecx */ |
105 | "lahf_lm", "cmp_legacy", "svm", "extapic", | | 105 | "lahf_lm", "cmp_legacy", "svm", "extapic", |
106 | "cr8_legacy", "abm", "sse4a", "misalignsse", | | 106 | "cr8_legacy", "abm", "sse4a", "misalignsse", |
107 | "3dnowprefetch", "osvw", "ibs", "xop", "skinit", "wdt", NULL, "lwp", | | 107 | "3dnowprefetch", "osvw", "ibs", "xop", "skinit", "wdt", NULL, "lwp", |
108 | "fma4", "tce", NULL, "nodeid_msr", | | 108 | "fma4", "tce", NULL, "nodeid_msr", |
109 | NULL, "tbm", "topoext", "perfctr_core", | | 109 | NULL, "tbm", "topoext", "perfctr_core", |
110 | "perfctr_nb", NULL, "bpext", "ptsc", | | 110 | "perfctr_nb", NULL, "bpext", "ptsc", |
111 | "perfctr_llc", "mwaitx", NULL, NULL}, | | 111 | "perfctr_llc", "mwaitx", NULL, NULL}, |
112 | | | 112 | |
113 | { /* (7) Linux mapping */ | | 113 | { /* (7) Linux mapping */ |
114 | NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm", | | 114 | NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm", |
115 | "hw_pstate", "proc_feedback", "sme", NULL, | | 115 | "hw_pstate", "proc_feedback", "sme", NULL, |
116 | NULL, NULL, NULL, NULL, | | 116 | NULL, NULL, NULL, NULL, |
117 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 117 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
118 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 118 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
119 | | | 119 | |
120 | { /* (8) Linux mapping */ | | 120 | { /* (8) Linux mapping */ |
121 | "tpr_shadow", "vnmi", "flexpriority", "ept", | | 121 | "tpr_shadow", "vnmi", "flexpriority", "ept", |
122 | "vpid", "npt", "lbrv", "svm_lock", | | 122 | "vpid", "npt", "lbrv", "svm_lock", |
123 | "nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid", | | 123 | "nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid", |
124 | "decodeassists", "pausefilter", "pfthreshold", "vmmcall", | | 124 | "decodeassists", "pausefilter", "pfthreshold", "vmmcall", |
125 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 125 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
126 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 126 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
127 | | | 127 | |
128 | { /* (9) Intel-defined: 00000007 ebx */ | | 128 | { /* (9) Intel-defined: 00000007 ebx */ |
129 | "fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep", | | 129 | "fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep", |
130 | "bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a", | | 130 | "bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a", |
131 | "avx512f", "avx512dq", "rdseed", "adx", | | 131 | "avx512f", "avx512dq", "rdseed", "adx", |
132 | "smap", NULL, NULL, "clflushopt", | | 132 | "smap", NULL, NULL, "clflushopt", |
133 | "clwb", "intel_pt", "avx512pf", "avx512er", | | 133 | "clwb", "intel_pt", "avx512pf", "avx512er", |
134 | "avx512cd", "sha_ni", "avx512bw", "avx512vl"}, | | 134 | "avx512cd", "sha_ni", "avx512bw", "avx512vl"}, |
135 | | | 135 | |
136 | { /* (10) 0x0000000d:1 eax */ | | 136 | { /* (10) 0x0000000d:1 eax */ |
137 | "xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL, | | 137 | "xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL, |
138 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 138 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
139 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 139 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
140 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 140 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
141 | | | 141 | |
142 | { /* (11) 0x0000000f:0 edx */ | | 142 | { /* (11) 0x0000000f:0 edx */ |
143 | NULL, "cqm_llc", NULL, NULL, NULL, NULL, NULL, NULL, | | 143 | NULL, "cqm_llc", NULL, NULL, NULL, NULL, NULL, NULL, |
144 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 144 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
145 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 145 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
146 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 146 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
147 | | | 147 | |
148 | { /* (12) 0x0000000f:1 edx */ | | 148 | { /* (12) 0x0000000f:1 edx */ |
149 | "cqm_occup_llc", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 149 | "cqm_occup_llc", NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
150 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 150 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
151 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 151 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
152 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 152 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
153 | | | 153 | |
154 | { /* (13) AMD 0x80000008 ebx */ | | 154 | { /* (13) AMD 0x80000008 ebx */ |
155 | "clzero", "irperf", "xsaveerptr", NULL, NULL, NULL, NULL, NULL, | | 155 | "clzero", "irperf", "xsaveerptr", NULL, NULL, NULL, NULL, NULL, |
156 | NULL, NULL, NULL, NULL, "ibpb", NULL, "ibrs", "stibp", | | 156 | NULL, NULL, NULL, NULL, "ibpb", NULL, "ibrs", "stibp", |
157 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 157 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
158 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 158 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
159 | | | 159 | |
160 | { /* (14) 0x00000006 eax */ | | 160 | { /* (14) 0x00000006 eax */ |
161 | "dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp", | | 161 | "dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp", |
162 | "hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req", | | 162 | "hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req", |
163 | NULL, NULL, NULL, NULL, | | 163 | NULL, NULL, NULL, NULL, |
164 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 164 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
165 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 165 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
166 | | | 166 | |
167 | { /* (15) 0x8000000a edx */ | | 167 | { /* (15) 0x8000000a edx */ |
168 | "npt", "lbrv", "svm_lock", "nrip_save", | | 168 | "npt", "lbrv", "svm_lock", "nrip_save", |
169 | "tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists", | | 169 | "tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists", |
170 | NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, | | 170 | NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, |
171 | "v_vmsave_vmload", | | 171 | "v_vmsave_vmload", |
172 | "vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 172 | "vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
173 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 173 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
174 | | | 174 | |
175 | { /* (16) 0x00000007:0 ecx */ | | 175 | { /* (16) 0x00000007:0 ecx */ |
176 | NULL, "avx512vbmi", "umip", "pku", | | 176 | NULL, "avx512vbmi", "umip", "pku", |
177 | "ospke", NULL, "avx512_vbmi2", NULL, | | 177 | "ospke", NULL, "avx512_vbmi2", NULL, |
178 | "gfni", "vaes", "vpclmulqdq", "avx512_vnni", | | 178 | "gfni", "vaes", "vpclmulqdq", "avx512_vnni", |
179 | "avx512_bitalg", NULL, "avx512_vpopcntdq", NULL, | | 179 | "avx512_bitalg", NULL, "avx512_vpopcntdq", NULL, |
180 | "la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL, | | 180 | "la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL, |
181 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 181 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
182 | | | 182 | |
183 | { /* (17) 0x80000007 ebx */ | | 183 | { /* (17) 0x80000007 ebx */ |
184 | "overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL, | | 184 | "overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL, |
185 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 185 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
186 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 186 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
187 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 187 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
188 | | | 188 | |
189 | { /* (18) Intel 0x00000007 edx */ | | 189 | { /* (18) Intel 0x00000007 edx */ |
190 | NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL, | | 190 | NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL, |
191 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 191 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
192 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 192 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
193 | NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, NULL}, | | 193 | NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, "ssbd"}, |
194 | }; | | 194 | }; |
195 | | | 195 | |
196 | static int procfs_getonecpu(int, struct cpu_info *, char *, size_t *); | | 196 | static int procfs_getonecpu(int, struct cpu_info *, char *, size_t *); |
197 | | | 197 | |
198 | /* | | 198 | /* |
199 | * Linux-style /proc/cpuinfo. | | 199 | * Linux-style /proc/cpuinfo. |
200 | * Only used when procfs is mounted with -o linux. | | 200 | * Only used when procfs is mounted with -o linux. |
201 | * | | 201 | * |
202 | * In the multiprocessor case, this should be a loop over all CPUs. | | 202 | * In the multiprocessor case, this should be a loop over all CPUs. |
203 | */ | | 203 | */ |
204 | int | | 204 | int |
205 | procfs_getcpuinfstr(char *bf, size_t *len) | | 205 | procfs_getcpuinfstr(char *bf, size_t *len) |
206 | { | | 206 | { |
207 | struct cpu_info *ci; | | 207 | struct cpu_info *ci; |
208 | CPU_INFO_ITERATOR cii; | | 208 | CPU_INFO_ITERATOR cii; |
209 | size_t i, total, size, used; | | 209 | size_t i, total, size, used; |
210 | | | 210 | |
211 | i = total = 0; | | 211 | i = total = 0; |
212 | used = size = *len; | | 212 | used = size = *len; |
213 | | | 213 | |
214 | for (CPU_INFO_FOREACH(cii, ci)) { | | 214 | for (CPU_INFO_FOREACH(cii, ci)) { |
215 | procfs_getonecpu(i++, ci, bf, &used); | | 215 | procfs_getonecpu(i++, ci, bf, &used); |
216 | total += used + 1; | | 216 | total += used + 1; |
217 | if (used + 1 <= size) { | | 217 | if (used + 1 <= size) { |
218 | bf += used; | | 218 | bf += used; |
219 | *bf++ = '\n'; | | 219 | *bf++ = '\n'; |
220 | size -= used + 1; | | 220 | size -= used + 1; |
221 | used = size; | | 221 | used = size; |
222 | } else | | 222 | } else |
223 | used = 0; | | 223 | used = 0; |
224 | } | | 224 | } |
225 | size = *len; | | 225 | size = *len; |
226 | *len = total; | | 226 | *len = total; |
227 | return size < *len ? -1 : 0; | | 227 | return size < *len ? -1 : 0; |
228 | } | | 228 | } |
229 | | | 229 | |
230 | static int | | 230 | static int |
231 | procfs_getonefeatreg(uint32_t reg, const char * const *table, char *p, | | 231 | procfs_getonefeatreg(uint32_t reg, const char * const *table, char *p, |
232 | size_t *left) | | 232 | size_t *left) |
233 | { | | 233 | { |
234 | size_t l; | | 234 | size_t l; |
235 | | | 235 | |
236 | for (size_t i = 0; i < 32; i++) { | | 236 | for (size_t i = 0; i < 32; i++) { |
237 | if ((reg & (1 << i)) && table[i]) { | | 237 | if ((reg & (1 << i)) && table[i]) { |
238 | l = snprintf(p, *left, "%s ", table[i]); | | 238 | l = snprintf(p, *left, "%s ", table[i]); |
239 | if (l < *left) { | | 239 | if (l < *left) { |
240 | *left -= l; | | 240 | *left -= l; |
241 | p += l; | | 241 | p += l; |
242 | } else | | 242 | } else |
243 | break; | | 243 | break; |
244 | } | | 244 | } |
245 | } | | 245 | } |
246 | | | 246 | |
247 | return 0; /* XXX */ | | 247 | return 0; /* XXX */ |
248 | } | | 248 | } |
249 | | | 249 | |
250 | /* | | 250 | /* |
251 | * Print feature bits. The code assume that unused entry of x86_features[] | | 251 | * Print feature bits. The code assume that unused entry of x86_features[] |
252 | * is zero-cleared. | | 252 | * is zero-cleared. |
253 | * | | 253 | * |
254 | * XXX This function will be rewritten when all of linux entries are | | 254 | * XXX This function will be rewritten when all of linux entries are |
255 | * decoded. | | 255 | * decoded. |
256 | */ | | 256 | */ |
257 | static int | | 257 | static int |
258 | procfs_getonecpufeatures(struct cpu_info *ci, char *p, size_t *left) | | 258 | procfs_getonecpufeatures(struct cpu_info *ci, char *p, size_t *left) |
259 | { | | 259 | { |
260 | size_t last = *left; | | 260 | size_t last = *left; |
261 | size_t diff; | | 261 | size_t diff; |
262 | u_int descs[4]; | | 262 | u_int descs[4]; |
263 | | | 263 | |
264 | procfs_getonefeatreg(ci->ci_feat_val[0], x86_features[0], p, left); | | 264 | procfs_getonefeatreg(ci->ci_feat_val[0], x86_features[0], p, left); |
265 | diff = last - *left; | | 265 | diff = last - *left; |
266 | | | 266 | |
267 | procfs_getonefeatreg(ci->ci_feat_val[2], x86_features[1], p + diff, | | 267 | procfs_getonefeatreg(ci->ci_feat_val[2], x86_features[1], p + diff, |
268 | left); | | 268 | left); |
269 | diff = last - *left; | | 269 | diff = last - *left; |
270 | | | 270 | |
271 | /* x86_features[2] is for Transmeta */ | | 271 | /* x86_features[2] is for Transmeta */ |
272 | /* x86_features[3] is Linux defined mapping */ | | 272 | /* x86_features[3] is Linux defined mapping */ |
273 | | | 273 | |
274 | procfs_getonefeatreg(ci->ci_feat_val[1], x86_features[4], p + diff, | | 274 | procfs_getonefeatreg(ci->ci_feat_val[1], x86_features[4], p + diff, |
275 | left); | | 275 | left); |
276 | diff = last - *left; | | 276 | diff = last - *left; |
277 | | | 277 | |
278 | procfs_getonefeatreg(ci->ci_feat_val[4], x86_features[5], p + diff, | | 278 | procfs_getonefeatreg(ci->ci_feat_val[4], x86_features[5], p + diff, |
279 | left); | | 279 | left); |
280 | diff = last - *left; | | 280 | diff = last - *left; |
281 | | | 281 | |
282 | procfs_getonefeatreg(ci->ci_feat_val[3], x86_features[6], p + diff, | | 282 | procfs_getonefeatreg(ci->ci_feat_val[3], x86_features[6], p + diff, |
283 | left); | | 283 | left); |
284 | diff = last - *left; | | 284 | diff = last - *left; |
285 | | | 285 | |
286 | /* x86_features[7] is Linux defined mapping */ | | 286 | /* x86_features[7] is Linux defined mapping */ |
287 | /* x86_features[8] is Linux defined mapping */ | | 287 | /* x86_features[8] is Linux defined mapping */ |
288 | | | 288 | |
289 | procfs_getonefeatreg(ci->ci_feat_val[5], x86_features[9], p + diff, | | 289 | procfs_getonefeatreg(ci->ci_feat_val[5], x86_features[9], p + diff, |
290 | left); | | 290 | left); |
291 | diff = last - *left; | | 291 | diff = last - *left; |
292 | | | 292 | |
293 | if (ci->ci_max_cpuid >= 0x0d) { | | 293 | if (ci->ci_max_cpuid >= 0x0d) { |
294 | x86_cpuid2(0x0d, 1, descs); | | 294 | x86_cpuid2(0x0d, 1, descs); |
295 | procfs_getonefeatreg(descs[0], x86_features[10], p + diff, | | 295 | procfs_getonefeatreg(descs[0], x86_features[10], p + diff, |
296 | left); | | 296 | left); |
297 | diff = last - *left; | | 297 | diff = last - *left; |
298 | } | | 298 | } |
299 | | | 299 | |
300 | if (ci->ci_max_cpuid >= 0x0f) { | | 300 | if (ci->ci_max_cpuid >= 0x0f) { |
301 | x86_cpuid2(0x0f, 0, descs); | | 301 | x86_cpuid2(0x0f, 0, descs); |
302 | procfs_getonefeatreg(descs[3], x86_features[11], p + diff, | | 302 | procfs_getonefeatreg(descs[3], x86_features[11], p + diff, |
303 | left); | | 303 | left); |
304 | diff = last - *left; | | 304 | diff = last - *left; |
305 | | | 305 | |
306 | x86_cpuid2(0x0f, 1, descs); | | 306 | x86_cpuid2(0x0f, 1, descs); |
307 | procfs_getonefeatreg(descs[3], x86_features[12], p + diff, | | 307 | procfs_getonefeatreg(descs[3], x86_features[12], p + diff, |
308 | left); | | 308 | left); |
309 | diff = last - *left; | | 309 | diff = last - *left; |
310 | } | | 310 | } |
311 | | | 311 | |
312 | if ((cpu_vendor == CPUVENDOR_AMD) | | 312 | if ((cpu_vendor == CPUVENDOR_AMD) |
313 | && (ci->ci_max_ext_cpuid >= 0x80000008)) { | | 313 | && (ci->ci_max_ext_cpuid >= 0x80000008)) { |
314 | x86_cpuid(0x80000008, descs); | | 314 | x86_cpuid(0x80000008, descs); |
315 | procfs_getonefeatreg(descs[1], x86_features[13], p + diff, | | 315 | procfs_getonefeatreg(descs[1], x86_features[13], p + diff, |
316 | left); | | 316 | left); |
317 | diff = last - *left; | | 317 | diff = last - *left; |
318 | } | | 318 | } |
319 | | | 319 | |
320 | if (ci->ci_max_cpuid >= 0x06) { | | 320 | if (ci->ci_max_cpuid >= 0x06) { |
321 | x86_cpuid(0x06, descs); | | 321 | x86_cpuid(0x06, descs); |
322 | procfs_getonefeatreg(descs[0], x86_features[14], p + diff, | | 322 | procfs_getonefeatreg(descs[0], x86_features[14], p + diff, |
323 | left); | | 323 | left); |
324 | diff = last - *left; | | 324 | diff = last - *left; |
325 | } | | 325 | } |
326 | | | 326 | |
327 | if ((cpu_vendor == CPUVENDOR_AMD) | | 327 | if ((cpu_vendor == CPUVENDOR_AMD) |
328 | && (ci->ci_max_ext_cpuid >= 0x8000000a)) { | | 328 | && (ci->ci_max_ext_cpuid >= 0x8000000a)) { |
329 | x86_cpuid(0x8000000a, descs); | | 329 | x86_cpuid(0x8000000a, descs); |
330 | procfs_getonefeatreg(descs[3], x86_features[15], p + diff, | | 330 | procfs_getonefeatreg(descs[3], x86_features[15], p + diff, |
331 | left); | | 331 | left); |
332 | diff = last - *left; | | 332 | diff = last - *left; |
333 | } | | 333 | } |
334 | | | 334 | |
335 | procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff, | | 335 | procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff, |
336 | left); | | 336 | left); |
337 | diff = last - *left; | | 337 | diff = last - *left; |
338 | | | 338 | |
339 | if ((cpu_vendor == CPUVENDOR_AMD) | | 339 | if ((cpu_vendor == CPUVENDOR_AMD) |
340 | && (ci->ci_max_ext_cpuid >= 0x80000007)) { | | 340 | && (ci->ci_max_ext_cpuid >= 0x80000007)) { |
341 | x86_cpuid(0x80000007, descs); | | 341 | x86_cpuid(0x80000007, descs); |
342 | procfs_getonefeatreg(descs[1], x86_features[17], p + diff, | | 342 | procfs_getonefeatreg(descs[1], x86_features[17], p + diff, |
343 | left); | | 343 | left); |
344 | diff = last - *left; | | 344 | diff = last - *left; |
345 | } | | 345 | } |
346 | | | 346 | |
347 | if ((cpu_vendor == CPUVENDOR_INTEL) | | 347 | if ((cpu_vendor == CPUVENDOR_INTEL) |
348 | && (ci->ci_max_cpuid >= 0x00000007)) { | | 348 | && (ci->ci_max_cpuid >= 0x00000007)) { |
349 | x86_cpuid(0x00000007, descs); | | 349 | x86_cpuid(0x00000007, descs); |
350 | procfs_getonefeatreg(descs[3], x86_features[18], p + diff, | | 350 | procfs_getonefeatreg(descs[3], x86_features[18], p + diff, |
351 | left); | | 351 | left); |
352 | diff = last - *left; | | 352 | diff = last - *left; |
353 | } | | 353 | } |
354 | | | 354 | |
355 | return 0; /* XXX */ | | 355 | return 0; /* XXX */ |
356 | } | | 356 | } |
357 | | | 357 | |
358 | static int | | 358 | static int |
359 | procfs_getonecpu(int xcpu, struct cpu_info *ci, char *bf, size_t *len) | | 359 | procfs_getonecpu(int xcpu, struct cpu_info *ci, char *bf, size_t *len) |
360 | { | | 360 | { |
361 | size_t left, l, size; | | 361 | size_t left, l, size; |
362 | char featurebuf[1024], *p; | | 362 | char featurebuf[1024], *p; |
363 | | | 363 | |
364 | p = featurebuf; | | 364 | p = featurebuf; |
365 | left = sizeof(featurebuf); | | 365 | left = sizeof(featurebuf); |
366 | size = *len; | | 366 | size = *len; |
367 | procfs_getonecpufeatures(ci, p, &left); | | 367 | procfs_getonecpufeatures(ci, p, &left); |
368 | | | 368 | |
369 | p = bf; | | 369 | p = bf; |
370 | left = *len; | | 370 | left = *len; |
371 | size = 0; | | 371 | size = 0; |
372 | l = snprintf(p, left, | | 372 | l = snprintf(p, left, |
373 | "processor\t: %d\n" | | 373 | "processor\t: %d\n" |
374 | "vendor_id\t: %s\n" | | 374 | "vendor_id\t: %s\n" |
375 | "cpu family\t: %d\n" | | 375 | "cpu family\t: %d\n" |
376 | "model\t\t: %d\n" | | 376 | "model\t\t: %d\n" |
377 | "model name\t: %s\n" | | 377 | "model name\t: %s\n" |
378 | "stepping\t: ", | | 378 | "stepping\t: ", |
379 | xcpu, | | 379 | xcpu, |
380 | (char *)ci->ci_vendor, | | 380 | (char *)ci->ci_vendor, |
381 | CPUID_TO_FAMILY(ci->ci_signature), | | 381 | CPUID_TO_FAMILY(ci->ci_signature), |
382 | CPUID_TO_MODEL(ci->ci_signature), | | 382 | CPUID_TO_MODEL(ci->ci_signature), |
383 | cpu_brand_string | | 383 | cpu_brand_string |
384 | ); | | 384 | ); |
385 | size += l; | | 385 | size += l; |
386 | if (l < left) { | | 386 | if (l < left) { |
387 | left -= l; | | 387 | left -= l; |
388 | p += l; | | 388 | p += l; |
389 | } else | | 389 | } else |
390 | left = 0; | | 390 | left = 0; |
391 | | | 391 | |
392 | if (cpuid_level >= 0) | | 392 | if (cpuid_level >= 0) |
393 | l = snprintf(p, left, "%d\n", | | 393 | l = snprintf(p, left, "%d\n", |
394 | CPUID_TO_STEPPING(ci->ci_signature)); | | 394 | CPUID_TO_STEPPING(ci->ci_signature)); |
395 | else | | 395 | else |
396 | l = snprintf(p, left, "unknown\n"); | | 396 | l = snprintf(p, left, "unknown\n"); |
397 | | | 397 | |
398 | size += l; | | 398 | size += l; |
399 | if (l < left) { | | 399 | if (l < left) { |
400 | left -= l; | | 400 | left -= l; |
401 | p += l; | | 401 | p += l; |
402 | } else | | 402 | } else |
403 | left = 0; | | 403 | left = 0; |
404 | | | 404 | |
405 | if (ci->ci_data.cpu_cc_freq != 0) { | | 405 | if (ci->ci_data.cpu_cc_freq != 0) { |
406 | uint64_t freq, fraq; | | 406 | uint64_t freq, fraq; |
407 | | | 407 | |
408 | freq = (ci->ci_data.cpu_cc_freq + 4999) / 1000000; | | 408 | freq = (ci->ci_data.cpu_cc_freq + 4999) / 1000000; |
409 | fraq = ((ci->ci_data.cpu_cc_freq + 4999) / 10000) % 100; | | 409 | fraq = ((ci->ci_data.cpu_cc_freq + 4999) / 10000) % 100; |
410 | l = snprintf(p, left, "cpu MHz\t\t: %" PRIu64 ".%02" PRIu64 | | 410 | l = snprintf(p, left, "cpu MHz\t\t: %" PRIu64 ".%02" PRIu64 |
411 | "\n", freq, fraq); | | 411 | "\n", freq, fraq); |
412 | } else | | 412 | } else |
413 | l = snprintf(p, left, "cpu MHz\t\t: unknown\n"); | | 413 | l = snprintf(p, left, "cpu MHz\t\t: unknown\n"); |
414 | | | 414 | |
415 | size += l; | | 415 | size += l; |
416 | if (l < left) { | | 416 | if (l < left) { |
417 | left -= l; | | 417 | left -= l; |
418 | p += l; | | 418 | p += l; |
419 | } else | | 419 | } else |
420 | left = 0; | | 420 | left = 0; |
421 | | | 421 | |
422 | l = snprintf(p, left, | | 422 | l = snprintf(p, left, |
423 | "apicid\t\t: %d\n" | | 423 | "apicid\t\t: %d\n" |
424 | "initial apicid\t: %d\n", | | 424 | "initial apicid\t: %d\n", |
425 | ci->ci_acpiid, | | 425 | ci->ci_acpiid, |
426 | ci->ci_initapicid | | 426 | ci->ci_initapicid |
427 | ); | | 427 | ); |
428 | size += l; | | 428 | size += l; |
429 | if (l < left) { | | 429 | if (l < left) { |
430 | left -= l; | | 430 | left -= l; |
431 | p += l; | | 431 | p += l; |
432 | } else | | 432 | } else |
433 | left = 0; | | 433 | left = 0; |
434 | | | 434 | |
435 | l = snprintf(p, left, | | 435 | l = snprintf(p, left, |
436 | #ifdef __i386__ | | 436 | #ifdef __i386__ |
437 | "fdiv_bug\t: %s\n" | | 437 | "fdiv_bug\t: %s\n" |
438 | #endif | | 438 | #endif |
439 | "fpu\t\t: %s\n" | | 439 | "fpu\t\t: %s\n" |
440 | "fpu_exception\t: yes\n" | | 440 | "fpu_exception\t: yes\n" |
441 | "cpuid level\t: %d\n" | | 441 | "cpuid level\t: %d\n" |
442 | "wp\t\t: %s\n" | | 442 | "wp\t\t: %s\n" |
443 | "flags\t\t: %s\n" | | 443 | "flags\t\t: %s\n" |
444 | "clflush size\t: %d\n", | | 444 | "clflush size\t: %d\n", |
445 | #ifdef __i386__ | | 445 | #ifdef __i386__ |
446 | i386_fpu_fdivbug ? "yes" : "no", /* an old pentium */ | | 446 | i386_fpu_fdivbug ? "yes" : "no", /* an old pentium */ |
447 | #endif | | 447 | #endif |
448 | i386_fpu_present ? "yes" : "no", /* not a 486SX */ | | 448 | i386_fpu_present ? "yes" : "no", /* not a 486SX */ |
449 | ci->ci_max_cpuid, | | 449 | ci->ci_max_cpuid, |
450 | (rcr0() & CR0_WP) ? "yes" : "no", | | 450 | (rcr0() & CR0_WP) ? "yes" : "no", |
451 | featurebuf, | | 451 | featurebuf, |
452 | ci->ci_cflush_lsize | | 452 | ci->ci_cflush_lsize |
453 | ); | | 453 | ); |
454 | size += l; | | 454 | size += l; |
455 | | | 455 | |
456 | left = *len; | | 456 | left = *len; |
457 | *len = size; | | 457 | *len = size; |
458 | return left < *len ? -1 : 0; | | 458 | return left < *len ? -1 : 0; |
459 | } | | 459 | } |
460 | | | 460 | |
461 | #if defined(__HAVE_PROCFS_MACHDEP) && !defined(__x86_64__) | | 461 | #if defined(__HAVE_PROCFS_MACHDEP) && !defined(__x86_64__) |
462 | | | 462 | |
463 | void | | 463 | void |
464 | procfs_machdep_allocvp(struct vnode *vp) | | 464 | procfs_machdep_allocvp(struct vnode *vp) |
465 | { | | 465 | { |
466 | struct pfsnode *pfs = vp->v_data; | | 466 | struct pfsnode *pfs = vp->v_data; |
467 | | | 467 | |
468 | switch (pfs->pfs_type) { | | 468 | switch (pfs->pfs_type) { |
469 | case Pmachdep_xmmregs: | | 469 | case Pmachdep_xmmregs: |
470 | /* /proc/N/xmmregs = -rw------- */ | | 470 | /* /proc/N/xmmregs = -rw------- */ |
471 | pfs->pfs_mode = S_IRUSR|S_IWUSR; | | 471 | pfs->pfs_mode = S_IRUSR|S_IWUSR; |
472 | vp->v_type = VREG; | | 472 | vp->v_type = VREG; |
473 | break; | | 473 | break; |
474 | default: | | 474 | default: |
475 | KASSERT(false); | | 475 | KASSERT(false); |
476 | } | | 476 | } |
477 | } | | 477 | } |
478 | | | 478 | |
479 | int | | 479 | int |
480 | procfs_machdep_rw(struct lwp *curl, struct lwp *l, struct pfsnode *pfs, | | 480 | procfs_machdep_rw(struct lwp *curl, struct lwp *l, struct pfsnode *pfs, |
481 | struct uio *uio) | | 481 | struct uio *uio) |
482 | { | | 482 | { |
483 | | | 483 | |
484 | switch (pfs->pfs_type) { | | 484 | switch (pfs->pfs_type) { |
485 | case Pmachdep_xmmregs: | | 485 | case Pmachdep_xmmregs: |
486 | return (procfs_machdep_doxmmregs(curl, l, pfs, uio)); | | 486 | return (procfs_machdep_doxmmregs(curl, l, pfs, uio)); |
487 | default: | | 487 | default: |
488 | KASSERT(false); | | 488 | KASSERT(false); |
489 | } | | 489 | } |
490 | return EINVAL; | | 490 | return EINVAL; |
491 | } | | 491 | } |
492 | | | 492 | |
493 | int | | 493 | int |
494 | procfs_machdep_getattr(struct vnode *vp, struct vattr *vap, struct proc *procp) | | 494 | procfs_machdep_getattr(struct vnode *vp, struct vattr *vap, struct proc *procp) |
495 | { | | 495 | { |
496 | struct pfsnode *pfs = VTOPFS(vp); | | 496 | struct pfsnode *pfs = VTOPFS(vp); |
497 | | | 497 | |
498 | switch (pfs->pfs_type) { | | 498 | switch (pfs->pfs_type) { |
499 | case Pmachdep_xmmregs: | | 499 | case Pmachdep_xmmregs: |
500 | vap->va_bytes = vap->va_size = sizeof(struct xmmregs); | | 500 | vap->va_bytes = vap->va_size = sizeof(struct xmmregs); |
501 | break; | | 501 | break; |
502 | default: | | 502 | default: |
503 | KASSERT(false); | | 503 | KASSERT(false); |
504 | } | | 504 | } |
505 | return 0; | | 505 | return 0; |
506 | } | | 506 | } |
507 | | | 507 | |
508 | int | | 508 | int |
509 | procfs_machdep_doxmmregs(struct lwp *curl, struct lwp *l, | | 509 | procfs_machdep_doxmmregs(struct lwp *curl, struct lwp *l, |
510 | struct pfsnode *pfs, struct uio *uio) | | 510 | struct pfsnode *pfs, struct uio *uio) |
511 | { | | 511 | { |
512 | | | 512 | |
513 | return process_machdep_doxmmregs(curl, l, uio); | | 513 | return process_machdep_doxmmregs(curl, l, uio); |
514 | } | | 514 | } |
515 | | | 515 | |
516 | int | | 516 | int |
517 | procfs_machdep_validxmmregs(struct lwp *l, struct mount *mp) | | 517 | procfs_machdep_validxmmregs(struct lwp *l, struct mount *mp) |
518 | { | | 518 | { |
519 | | | 519 | |
520 | return process_machdep_validxmmregs(l->l_proc); | | 520 | return process_machdep_validxmmregs(l->l_proc); |
521 | } | | 521 | } |
522 | | | 522 | |
523 | #endif | | 523 | #endif |