summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2003-12-18 08:05:20 +0000
committermickey <mickey@openbsd.org>2003-12-18 08:05:20 +0000
commitc95fe8b89c9fdf0172f5d8637a43f37338498c1c (patch)
tree3143ca15ed0e0eb179302af0781d36d48efb51fe
parentDon't add -I$(srcdir)/zlib to CFLAGS since the version of zlib included with (diff)
downloadwireguard-openbsd-c95fe8b89c9fdf0172f5d8637a43f37338498c1c.tar.xz
wireguard-openbsd-c95fe8b89c9fdf0172f5d8637a43f37338498c1c.zip
spls do not protect cpu_itmr and thus time might jump back sometimes due to cpu_itmr modified to a higher value than a read itmr; found and testing by miod@
-rw-r--r--sys/arch/hppa/hppa/machdep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index d710f7e79b7..d4144f091fc 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.119 2003/12/17 05:46:37 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.120 2003/12/18 08:05:20 mickey Exp $ */
/*
* Copyright (c) 1999-2002 Michael Shalayeff
@@ -754,15 +754,17 @@ void
microtime(struct timeval *tv)
{
extern u_long cpu_itmr;
- u_long itmr;
+ u_long itmr, mask;
int s;
s = splhigh();
tv->tv_sec = time.tv_sec;
tv->tv_usec = time.tv_usec;
+ rsm(PSL_I, mask);
mfctl(CR_ITMR, itmr);
itmr -= cpu_itmr;
+ ssm(PSL_I, mask);
splx(s);
tv->tv_usec += itmr * cpu_ticksdenom / cpu_ticksnum;