diff options
author | bde <bde@FreeBSD.org> | 1999-07-18 15:19:29 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1999-07-18 15:19:29 +0000 |
commit | e871bb8dd7a2153c5cabea19b8bf1c7cb7d3ac7a (patch) | |
tree | 4888031468dad73af57f3a7b1921e701a5a0010c /sys/amd64/amd64/tsc.c | |
parent | 9ea61245a8fa724c231c6740852b5a8bc59549ac (diff) | |
download | FreeBSD-src-e871bb8dd7a2153c5cabea19b8bf1c7cb7d3ac7a.zip FreeBSD-src-e871bb8dd7a2153c5cabea19b8bf1c7cb7d3ac7a.tar.gz |
Don't let the machdep.tsc_freq sysctl proceed if the TSC is present
but broken, since tsc_timecounter is not initialised in that case,
and updating an uninitialised timecounter is fatal.
Fixed style bugs in the machdep.i8254_freq and machdep.tsc_freq
sysctls.
Reviewed by: phk
Diffstat (limited to 'sys/amd64/amd64/tsc.c')
-rw-r--r-- | sys/amd64/amd64/tsc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 6f4ab12..1b2bb63 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.137 1999/06/24 03:48:25 green Exp $ + * $Id: clock.c,v 1.138 1999/06/27 09:08:48 peter Exp $ */ /* @@ -1107,7 +1107,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS * is is too generic. Should use it everywhere. */ freq = timer_freq; - error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req); + error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); if (error == 0 && req->newptr != NULL) { if (timer0_state != RELEASED) return (EBUSY); /* too much trouble to handle */ @@ -1119,7 +1119,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS } SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_i8254_freq, "I", ""); + 0, sizeof(u_int), sysctl_machdep_i8254_freq, "I", ""); static int sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS @@ -1127,10 +1127,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS int error; u_int freq; - if (!tsc_present) + if (tsc_timecounter.tc_frequency == 0) return (EOPNOTSUPP); freq = tsc_freq; - error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req); + error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); if (error == 0 && req->newptr != NULL) { tsc_freq = freq; tsc_timecounter.tc_frequency = tsc_freq; @@ -1140,7 +1140,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS } SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", ""); + 0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", ""); static unsigned i8254_get_timecount(struct timecounter *tc) |