[pups] 2.11BSD networking on simulator
Steven M. Schultz
sms at moe.2bsd.com
Sun Feb 4 10:03:00 AEST 2001
Hi -
> From: Per Andersson <pa at cdg.chalmers.se>
>
> This might not be state-of-the-art (but thats not the point anyway), I'm
> running p11 version 2.5 on an FreeBSD 3.4 machine and it works ok, the main
> problem I have found is that after a while the clock starts to run slow,
> at the momement it thinks it's christmas eve (after beeing up about 130 days).
The bug is an arithmetic overflow in the clock computations. After
about 24 days (with 60Hz power in the US) the number of ticks the
virtual machine has been up overflows 32 bits and time behaves very
strange.
Apply the patch below to 'device.c' and the problem goes away - it did
for me.
Steven Schultz
sms at moe.2bsd.com
--- device.c.dist Sat Mar 4 00:03:28 2000
+++ device.c Fri Sep 29 23:59:10 2000
@@ -203,6 +203,7 @@
int secs;
int newrate, diff;
int newdir;
+ double dnow, dstart;
for(t = timeouts; t < &timeouts[ntimeouts]; t++)
if(t->time && --t->curr == 0) {
@@ -223,9 +224,9 @@
* to the number we have elapsed
*/
gettimeofday(&tv, NULL);
- secs = ((1000 * tv.tv_sec + tv.tv_usec/1000)
- - (1000 * timer.start.tv_sec + timer.start.tv_usec/1000))
- / 1000;
+ dstart = 1000.0 * timer.start.tv_sec + timer.start.tv_usec/1000.0;
+ dnow = 1000.0 * tv.tv_sec + tv.tv_usec/1000.0;
+ secs = (dnow - dstart) / 1000.0;
newrate = 1000000 / clock_rate;
Received: (from major at localhost)
by minnie.cs.adfa.edu.au (8.9.3/8.9.3) id LAA55652
for pups-liszt; Sun, 4 Feb 2001 11:55:21 +1100 (EST)
(envelope-from owner-pups at minnie.cs.adfa.edu.au)
More information about the TUHS
mailing list