diff options
author | 2020-12-13 06:14:35 +0000 | |
---|---|---|
committer | 2020-12-13 06:14:35 +0000 | |
commit | bd5abcecd68d7ea6afa62a4ce2c2c23747afe5b1 (patch) | |
tree | f4a961f3231aaadd40a7a4b95a066877bf07743a | |
parent | set scatterlist to NULL after free (diff) | |
download | wireguard-openbsd-bd5abcecd68d7ea6afa62a4ce2c2c23747afe5b1.tar.xz wireguard-openbsd-bd5abcecd68d7ea6afa62a4ce2c2c23747afe5b1.zip |
Turn simple sysctl_rdint into cpuctl_vars entries
ok gkoehler@
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index e12700c1576..1a49c56376e 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.270 2020/11/08 20:37:22 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.271 2020/12/13 06:14:35 gnezdo Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -469,9 +469,16 @@ bios_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, /* NOTREACHED */ } +extern int tsc_is_invariant; +extern int amd64_has_xcrypt; + const struct sysctl_bounded_args cpuctl_vars[] = { { CPU_LIDACTION, &lid_action, 0, 2 }, { CPU_PWRACTION, &pwr_action, 0, 2 }, + { CPU_CPUID, &cpu_id, 1, 0 }, + { CPU_CPUFEATURE, &cpu_feature, 1, 0 }, + { CPU_XCRYPT, &amd64_has_xcrypt, 1, 0 }, + { CPU_INVARIANTTSC, &tsc_is_invariant, 1, 0 }, }; /* @@ -482,8 +489,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen, struct proc *p) { extern uint64_t tsc_frequency; - extern int tsc_is_invariant; - extern int amd64_has_xcrypt; dev_t consdev; dev_t dev; @@ -507,10 +512,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, newp, newlen, p); case CPU_CPUVENDOR: return (sysctl_rdstring(oldp, oldlenp, newp, cpu_vendor)); - case CPU_CPUID: - return (sysctl_rdint(oldp, oldlenp, newp, cpu_id)); - case CPU_CPUFEATURE: - return (sysctl_rdint(oldp, oldlenp, newp, cpu_feature)); case CPU_KBDRESET: if (securelevel > 0) return (sysctl_rdint(oldp, oldlenp, newp, @@ -531,8 +532,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, #else return (sysctl_rdint(oldp, oldlenp, newp, 0)); #endif - case CPU_XCRYPT: - return (sysctl_rdint(oldp, oldlenp, newp, amd64_has_xcrypt)); #if NPCKBC > 0 && NUKBD > 0 case CPU_FORCEUKBD: { @@ -549,8 +548,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, #endif case CPU_TSCFREQ: return (sysctl_rdquad(oldp, oldlenp, newp, tsc_frequency)); - case CPU_INVARIANTTSC: - return (sysctl_rdint(oldp, oldlenp, newp, tsc_is_invariant)); default: return (sysctl_bounded_arr(cpuctl_vars, nitems(cpuctl_vars), name, namelen, oldp, oldlenp, newp, newlen)); |