mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-30 15:38:06 +01:00
Add support for adjkerntz (largely untested).
This commit is contained in:
parent
0f222cb034
commit
ac43c74df8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39995
@ -1,4 +1,4 @@
|
||||
/* $Id: clock.c,v 1.2 1998/06/14 13:44:38 dfr Exp $ */
|
||||
/* $Id: clock.c,v 1.3 1998/07/22 08:16:34 dfr Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.20 1998/01/31 10:32:47 ross Exp $ */
|
||||
|
||||
/*
|
||||
@ -67,6 +67,8 @@ device_t clockdev;
|
||||
int clockinitted;
|
||||
int tickfix;
|
||||
int tickfixinterval;
|
||||
int adjkerntz; /* local offset from GMT in seconds */
|
||||
int disable_rtc_set; /* disable resettodr() if != 0 */
|
||||
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
|
||||
static int beeping = 0;
|
||||
|
||||
@ -280,6 +282,8 @@ inittodr(base)
|
||||
s = splclock();
|
||||
ts.tv_sec =
|
||||
days * SECDAY + ct.hour * SECHOUR + ct.min * SECMIN + ct.sec;
|
||||
if (wall_cmos_clock)
|
||||
ts.tv_sec += adjkerntz;
|
||||
ts.tv_nsec = 0;
|
||||
set_timecounter(&ts);
|
||||
splx(s);
|
||||
@ -315,6 +319,9 @@ resettodr()
|
||||
struct clocktime ct;
|
||||
unsigned long tm;
|
||||
|
||||
if (disable_rtc_set)
|
||||
return;
|
||||
|
||||
s = splclock();
|
||||
tm = time_second;
|
||||
splx(s);
|
||||
@ -322,6 +329,9 @@ resettodr()
|
||||
if (!clockinitted)
|
||||
return;
|
||||
|
||||
/* Calculate local time to put in RTC */
|
||||
tm -= (wall_cmos_clock ? adjkerntz : 0);
|
||||
|
||||
/* compute the day of week. */
|
||||
t2 = tm / SECDAY;
|
||||
ct.dow = (t2 + 4) % 7; /* 1/1/1970 was thursday */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: machdep.c,v 1.13 1998/09/14 22:43:19 jdp Exp $
|
||||
* $Id: machdep.c,v 1.14 1998/09/17 09:35:31 dfr Exp $
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -154,7 +154,6 @@ struct pcb* curpcb;
|
||||
u_int64_t cycles_per_usec;
|
||||
u_int32_t cycles_per_sec;
|
||||
int whichqs, whichrtqs, whichidqs;
|
||||
int adjkerntz;
|
||||
int cold = 1;
|
||||
struct platform platform;
|
||||
alpha_chipset_t chipset;
|
||||
@ -1828,3 +1827,23 @@ bad:
|
||||
return(-1);
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_machdep_adjkerntz SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error;
|
||||
error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2,
|
||||
req);
|
||||
if (!error && req->newptr)
|
||||
resettodr();
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,
|
||||
&adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "");
|
||||
|
||||
SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set,
|
||||
CTLFLAG_RW, &disable_rtc_set, 0, "");
|
||||
|
||||
SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
|
||||
CTLFLAG_RW, &wall_cmos_clock, 0, "");
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Garrett Wollman, September 1994.
|
||||
* This file is in the public domain.
|
||||
*
|
||||
* $Id: clock.h,v 1.1 1998/06/10 10:54:35 dfr Exp $
|
||||
* $Id: clock.h,v 1.2 1998/07/22 08:26:23 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CLOCK_H_
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
extern int disable_rtc_set;
|
||||
extern int wall_cmos_clock;
|
||||
extern int adjkerntz;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cpu.h,v 1.2 1998/06/10 10:54:45 dfr Exp $ */
|
||||
/* $Id: cpu.h,v 1.3 1998/07/12 16:32:06 dfr Exp $ */
|
||||
/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */
|
||||
|
||||
/*
|
||||
@ -107,7 +107,10 @@ u_int32_t want_resched; /* resched() was called */
|
||||
#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */
|
||||
#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */
|
||||
#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */
|
||||
#define CPU_MAXID 7 /* 6 valid machdep IDs */
|
||||
#define CPU_ADJKERNTZ 7 /* int: timezone offset (seconds) */
|
||||
#define CPU_DISRTCSET 8 /* int: disable resettodr() call */
|
||||
#define CPU_WALLCLOCK 9 /* int: indicates wall CMOS clock */
|
||||
#define CPU_MAXID 9 /* 9 valid machdep IDs */
|
||||
|
||||
#define CTL_MACHDEP_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
@ -117,6 +120,9 @@ u_int32_t want_resched; /* resched() was called */
|
||||
{ "unaligned_fix", CTLTYPE_INT }, \
|
||||
{ "unaligned_sigbus", CTLTYPE_INT }, \
|
||||
{ "booted_kernel", CTLTYPE_STRING }, \
|
||||
{ "adjkerntz", CTLTYPE_INT }, \
|
||||
{ "disable_rtc_set", CTLTYPE_INT }, \
|
||||
{ "wall_cmos_clock", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
#ifdef KERNEL
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Garrett Wollman, September 1994.
|
||||
* This file is in the public domain.
|
||||
*
|
||||
* $Id: clock.h,v 1.1 1998/06/10 10:54:35 dfr Exp $
|
||||
* $Id: clock.h,v 1.2 1998/07/22 08:26:23 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CLOCK_H_
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
extern int disable_rtc_set;
|
||||
extern int wall_cmos_clock;
|
||||
extern int adjkerntz;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user