| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $ */ | | 1 | /* $NetBSD: procfs_machdep.c,v 1.15.2.12 2021/12/03 19:53:32 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. |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
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.11 2020/07/20 18:40:08 martin Exp $"); | | 45 | __KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.12 2021/12/03 19:53:32 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> |
| @@ -72,71 +72,73 @@ static const char * const x86_features[] | | | @@ -72,71 +72,73 @@ static const char * const x86_features[] |
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", "k6_mtrr", "cyrix_arr", "centaur_mcr", NULL, NULL, NULL, NULL, |
86 | "constant_tsc", NULL, NULL, | | 86 | "constant_tsc", "up", "art", "arch_perfmon", |
87 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 87 | "pebs", "bts", NULL, NULL, |
88 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 88 | "rep_good", NULL, NULL, "acc_power", |
89 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 89 | "nopl", NULL, "xtopology", "tsc_reliable", |
| | | 90 | "nonstop_tsc", "cpuid", "extd_apicid", "amd_dcm", |
| | | 91 | "aperfmperf", "rapl", "nonstop_tsc_s3", "tsc_known_freq"}, |
90 | | | 92 | |
91 | { /* (4) Intel-defined: 0x00000001 ecx */ | | 93 | { /* (4) Intel-defined: 0x00000001 ecx */ |
92 | "pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est", | | 94 | "pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est", |
93 | "tm2", "ssse3", "cid", "sdbg", "fma", "cx16", "xtpr", "pdcm", | | 95 | "tm2", "ssse3", "cid", "sdbg", "fma", "cx16", "xtpr", "pdcm", |
94 | NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt", | | 96 | NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt", |
95 | "tsc_deadline_timer", "aes", "xsave", NULL, | | 97 | "tsc_deadline_timer", "aes", "xsave", NULL, |
96 | "avx", "f16c", "rdrand", "hypervisor"}, | | 98 | "avx", "f16c", "rdrand", "hypervisor"}, |
97 | | | 99 | |
98 | { /* (5) VIA/Cyrix/Centaur-defined */ | | 100 | { /* (5) VIA/Cyrix/Centaur-defined */ |
99 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | | 101 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", |
100 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | | 102 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, |
101 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 103 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
102 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 104 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
103 | | | 105 | |
104 | { /* (6) AMD defined 80000001 ecx */ | | 106 | { /* (6) AMD defined 80000001 ecx */ |
105 | "lahf_lm", "cmp_legacy", "svm", "extapic", | | 107 | "lahf_lm", "cmp_legacy", "svm", "extapic", |
106 | "cr8_legacy", "abm", "sse4a", "misalignsse", | | 108 | "cr8_legacy", "abm", "sse4a", "misalignsse", |
107 | "3dnowprefetch", "osvw", "ibs", "xop", "skinit", "wdt", NULL, "lwp", | | 109 | "3dnowprefetch", "osvw", "ibs", "xop", "skinit", "wdt", NULL, "lwp", |
108 | "fma4", "tce", NULL, "nodeid_msr", | | 110 | "fma4", "tce", NULL, "nodeid_msr", |
109 | NULL, "tbm", "topoext", "perfctr_core", | | 111 | NULL, "tbm", "topoext", "perfctr_core", |
110 | "perfctr_nb", NULL, "bpext", "ptsc", | | 112 | "perfctr_nb", NULL, "bpext", "ptsc", |
111 | "perfctr_llc", "mwaitx", NULL, NULL}, | | 113 | "perfctr_llc", "mwaitx", NULL, NULL}, |
112 | | | 114 | |
113 | { /* (7) Linux mapping */ | | 115 | { /* (7) Linux mapping */ |
114 | NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm", | | 116 | NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm", |
115 | "hw_pstate", "proc_feedback", "sme", NULL, | | 117 | "hw_pstate", "proc_feedback", NULL, NULL, |
116 | NULL, NULL, NULL, NULL, | | 118 | NULL, NULL, NULL, NULL, |
117 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 119 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
118 | NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL}, | | 120 | NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL}, |
119 | | | 121 | |
120 | { /* (8) Linux mapping */ | | 122 | { /* (8) Linux mapping */ |
121 | "tpr_shadow", "vnmi", "flexpriority", "ept", | | 123 | "tpr_shadow", "vnmi", "flexpriority", "ept", |
122 | "vpid", "npt", "lbrv", "svm_lock", | | 124 | "vpid", "npt", "lbrv", "svm_lock", |
123 | "nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid", | | 125 | "nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid", |
124 | "decodeassists", "pausefilter", "pfthreshold", "vmmcall", | | 126 | "decodeassists", "pausefilter", "pfthreshold", "vmmcall", |
125 | NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL, | | 127 | NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL, |
126 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 128 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
127 | | | 129 | |
128 | { /* (9) Intel-defined: 00000007 ebx */ | | 130 | { /* (9) Intel-defined: 00000007 ebx */ |
129 | "fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep", | | 131 | "fsgsbase", "tsc_adjust", "sgx", "bmi1", "hle", "avx2", NULL, "smep", |
130 | "bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a", | | 132 | "bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a", |
131 | "avx512f", "avx512dq", "rdseed", "adx", | | 133 | "avx512f", "avx512dq", "rdseed", "adx", |
132 | "smap", "avx512ifma", NULL, "clflushopt", | | 134 | "smap", "avx512ifma", NULL, "clflushopt", |
133 | "clwb", "intel_pt", "avx512pf", "avx512er", | | 135 | "clwb", "intel_pt", "avx512pf", "avx512er", |
134 | "avx512cd", "sha_ni", "avx512bw", "avx512vl"}, | | 136 | "avx512cd", "sha_ni", "avx512bw", "avx512vl"}, |
135 | | | 137 | |
136 | { /* (10) 0x0000000d:1 eax */ | | 138 | { /* (10) 0x0000000d:1 eax */ |
137 | "xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL, | | 139 | "xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL, |
138 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 140 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
139 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 141 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
140 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 142 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
141 | | | 143 | |
142 | { /* (11) 0x0000000f:0 edx */ | | 144 | { /* (11) 0x0000000f:0 edx */ |
| @@ -155,54 +157,60 @@ static const char * const x86_features[] | | | @@ -155,54 +157,60 @@ static const char * const x86_features[] |
155 | { /* (13) AMD 0x80000008 ebx */ | | 157 | { /* (13) AMD 0x80000008 ebx */ |
156 | "clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL, | | 158 | "clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL, |
157 | NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL, | | 159 | NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL, |
158 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin", | | 160 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin", |
159 | NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL}, | | 161 | NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL}, |
160 | | | 162 | |
161 | { /* (14) 0x00000006 eax */ | | 163 | { /* (14) 0x00000006 eax */ |
162 | "dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp", | | 164 | "dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp", |
163 | "hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req", | | 165 | "hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req", |
164 | NULL, NULL, NULL, NULL, | | 166 | NULL, NULL, NULL, NULL, |
165 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 167 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
166 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 168 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
167 | | | 169 | |
168 | { /* (15) 0x8000000a edx */ | | 170 | { /* (15) AMD 0x8000000a edx */ |
169 | "npt", "lbrv", "svm_lock", "nrip_save", | | 171 | "npt", "lbrv", "svm_lock", "nrip_save", |
170 | "tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists", | | 172 | "tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists", |
171 | NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, | | 173 | NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, |
172 | "v_vmsave_vmload", | | 174 | "v_vmsave_vmload", |
173 | "vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 175 | "vgif", NULL, NULL, NULL, "v_spec_ctrl", NULL, NULL, NULL, |
174 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 176 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
175 | | | 177 | |
176 | { /* (16) 0x00000007:0 ecx */ | | 178 | { /* (16) 0x00000007:0 ecx */ |
177 | NULL, "avx512vbmi", "umip", "pku", | | 179 | NULL, "avx512vbmi", "umip", "pku", |
178 | "ospke", "waitpkg", "avx512_vbmi2", NULL, | | 180 | "ospke", "waitpkg", "avx512_vbmi2", NULL, |
179 | "gfni", "vaes", "vpclmulqdq", "avx512_vnni", | | 181 | "gfni", "vaes", "vpclmulqdq", "avx512_vnni", |
180 | "avx512_bitalg", "tme", "avx512_vpopcntdq", NULL, | | 182 | "avx512_bitalg", "tme", "avx512_vpopcntdq", NULL, |
181 | "la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL, | | 183 | "la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL, |
182 | NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, NULL, NULL}, | | 184 | NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgx_lc", NULL}, |
183 | | | 185 | |
184 | { /* (17) 0x80000007 ebx */ | | 186 | { /* (17) 0x80000007 ebx */ |
185 | "overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL, | | 187 | "overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL, |
186 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 188 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
187 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | | 189 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
188 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | | 190 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
189 | | | 191 | |
190 | { /* (18) Intel 0x00000007 edx */ | | 192 | { /* (18) Intel 0x00000007 edx */ |
191 | NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL, | | 193 | NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL, |
192 | "vp2intersect", NULL, "md_clear", NULL, NULL, NULL, NULL, NULL, | | 194 | "vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL, |
193 | NULL, NULL, "pconfig", NULL, NULL, NULL, NULL, NULL, | | 195 | "tsxldtrk", NULL, "pconfig", NULL, NULL, NULL, NULL, "avx512_fp16", |
194 | NULL, NULL, NULL, NULL, | | 196 | NULL, NULL, NULL, NULL, |
195 | "flush_l1d", "arch_capabilities", NULL, "ssbd"}, | | 197 | "flush_l1d", "arch_capabilities", NULL, "ssbd"}, |
| | | 198 | |
| | | 199 | { /* (19) AMD 0x8000001f eax */ |
| | | 200 | "sme", "sev", NULL, "sev_es", NULL, NULL, NULL, NULL, |
| | | 201 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| | | 202 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| | | 203 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
196 | }; | | 204 | }; |
197 | | | 205 | |
198 | static int procfs_getonecpu(int, struct cpu_info *, char *, size_t *); | | 206 | static int procfs_getonecpu(int, struct cpu_info *, char *, size_t *); |
199 | | | 207 | |
200 | /* | | 208 | /* |
201 | * Linux-style /proc/cpuinfo. | | 209 | * Linux-style /proc/cpuinfo. |
202 | * Only used when procfs is mounted with -o linux. | | 210 | * Only used when procfs is mounted with -o linux. |
203 | * | | 211 | * |
204 | * In the multiprocessor case, this should be a loop over all CPUs. | | 212 | * In the multiprocessor case, this should be a loop over all CPUs. |
205 | */ | | 213 | */ |
206 | int | | 214 | int |
207 | procfs_getcpuinfstr(char *bf, size_t *len) | | 215 | procfs_getcpuinfstr(char *bf, size_t *len) |
208 | { | | 216 | { |
| @@ -262,27 +270,27 @@ procfs_getonecpufeatures(struct cpu_info | | | @@ -262,27 +270,27 @@ procfs_getonecpufeatures(struct cpu_info |
262 | size_t last = *left; | | 270 | size_t last = *left; |
263 | size_t diff; | | 271 | size_t diff; |
264 | u_int descs[4]; | | 272 | u_int descs[4]; |
265 | | | 273 | |
266 | procfs_getonefeatreg(ci->ci_feat_val[0], x86_features[0], p, left); | | 274 | procfs_getonefeatreg(ci->ci_feat_val[0], x86_features[0], p, left); |
267 | diff = last - *left; | | 275 | diff = last - *left; |
268 | | | 276 | |
269 | procfs_getonefeatreg(ci->ci_feat_val[2], x86_features[1], p + diff, | | 277 | procfs_getonefeatreg(ci->ci_feat_val[2], x86_features[1], p + diff, |
270 | left); | | 278 | left); |
271 | diff = last - *left; | | 279 | diff = last - *left; |
272 | | | 280 | |
273 | /* x86_features[2] is for Transmeta */ | | 281 | /* x86_features[2] is for Transmeta */ |
274 | /* x86_features[3] is Linux defined mapping */ | | 282 | /* x86_features[3] is Linux defined mapping */ |
275 | | | 283 | |
276 | procfs_getonefeatreg(ci->ci_feat_val[1], x86_features[4], p + diff, | | 284 | procfs_getonefeatreg(ci->ci_feat_val[1], x86_features[4], p + diff, |
277 | left); | | 285 | left); |
278 | diff = last - *left; | | 286 | diff = last - *left; |
279 | | | 287 | |
280 | procfs_getonefeatreg(ci->ci_feat_val[4], x86_features[5], p + diff, | | 288 | procfs_getonefeatreg(ci->ci_feat_val[4], x86_features[5], p + diff, |
281 | left); | | 289 | left); |
282 | diff = last - *left; | | 290 | diff = last - *left; |
283 | | | 291 | |
284 | procfs_getonefeatreg(ci->ci_feat_val[3], x86_features[6], p + diff, | | 292 | procfs_getonefeatreg(ci->ci_feat_val[3], x86_features[6], p + diff, |
285 | left); | | 293 | left); |
286 | diff = last - *left; | | 294 | diff = last - *left; |
287 | | | 295 | |
288 | /* x86_features[7] is Linux defined mapping */ | | 296 | /* x86_features[7] is Linux defined mapping */ |
| @@ -344,26 +352,34 @@ procfs_getonecpufeatures(struct cpu_info | | | @@ -344,26 +352,34 @@ procfs_getonecpufeatures(struct cpu_info |
344 | procfs_getonefeatreg(descs[1], x86_features[17], p + diff, | | 352 | procfs_getonefeatreg(descs[1], x86_features[17], p + diff, |
345 | left); | | 353 | left); |
346 | diff = last - *left; | | 354 | diff = last - *left; |
347 | } | | 355 | } |
348 | | | 356 | |
349 | if ((cpu_vendor == CPUVENDOR_INTEL) | | 357 | if ((cpu_vendor == CPUVENDOR_INTEL) |
350 | && (ci->ci_max_cpuid >= 0x00000007)) { | | 358 | && (ci->ci_max_cpuid >= 0x00000007)) { |
351 | x86_cpuid(0x00000007, descs); | | 359 | x86_cpuid(0x00000007, descs); |
352 | procfs_getonefeatreg(descs[3], x86_features[18], p + diff, | | 360 | procfs_getonefeatreg(descs[3], x86_features[18], p + diff, |
353 | left); | | 361 | left); |
354 | diff = last - *left; | | 362 | diff = last - *left; |
355 | } | | 363 | } |
356 | | | 364 | |
| | | 365 | if ((cpu_vendor == CPUVENDOR_AMD) |
| | | 366 | && (ci->ci_max_ext_cpuid >= 0x80000019)) { |
| | | 367 | x86_cpuid(0x8000001f, descs); |
| | | 368 | procfs_getonefeatreg(descs[0], x86_features[19], p + diff, |
| | | 369 | left); |
| | | 370 | diff = last - *left; |
| | | 371 | } |
| | | 372 | |
357 | return 0; /* XXX */ | | 373 | return 0; /* XXX */ |
358 | } | | 374 | } |
359 | | | 375 | |
360 | static int | | 376 | static int |
361 | procfs_getonecpu(int xcpu, struct cpu_info *ci, char *bf, size_t *len) | | 377 | procfs_getonecpu(int xcpu, struct cpu_info *ci, char *bf, size_t *len) |
362 | { | | 378 | { |
363 | size_t left, l, size; | | 379 | size_t left, l, size; |
364 | char featurebuf[1024], *p; | | 380 | char featurebuf[1024], *p; |
365 | | | 381 | |
366 | p = featurebuf; | | 382 | p = featurebuf; |
367 | left = sizeof(featurebuf); | | 383 | left = sizeof(featurebuf); |
368 | size = *len; | | 384 | size = *len; |
369 | procfs_getonecpufeatures(ci, p, &left); | | 385 | procfs_getonecpufeatures(ci, p, &left); |