diff --git a/em.c b/em.c index ffbb698..0511c8f 100644 --- a/em.c +++ b/em.c @@ -4408,12 +4408,16 @@ int main (int argc, char **argv) { } setvbuf(stderr, NULL, _IONBF, 0); - /* initialize global variables */ + /* initialize global variables + + NOTE: if instpermsec is off by more than a factor of 2, it causes + some minor clock skew problems during the first few seconds of + system boot. There is debug code in emdev.h/devcp to see this. */ gv.intvec = -1; gv.instcount = 0; gv.inhcount = 0; - gv.instpermsec = 2000; + gv.instpermsec = 40000; gv.livereglim = 040; gv.mapvacalls = 0; gv.mapvamisses = 0; diff --git a/emdev.h b/emdev.h index 2491bc9..dfb333a 100644 --- a/emdev.h +++ b/emdev.h @@ -1530,15 +1530,15 @@ int devcp (int class, int func, int device) { else if (cpuid >= 15) /* newer machines: 250 ticks/second */ clkpic = -1250; TRACE(T_INST, "Clock PIC %d requested, set to %d\n", getcrs16s(A), clkpic); - SETCLKPOLL; ticks = -1; + SETCLKPOLL; } else if (func == 07) { - TRACE(T_INST, "Clock control register set to '%o\n", getcrs16(A)); if (getcrs16(A) & 020) clkrate = 102.4; else clkrate = 3.2; + TRACE(T_INST, "Clock control register set to '%o\n", getcrs16(A)); ticks = -1; SETCLKPOLL; @@ -1586,7 +1586,7 @@ int devcp (int class, int func, int device) { targetticks = elapsedms/(-clkpic*clkrate/1000); #if 0 if (abs(ticks-targetticks) > 5) - printf("\nClock: target=%d, ticks=%d, offset=%d\n", targetticks, ticks, ticks-targetticks); + printf("\nClock: target=%d, ticks=%d, offset=%d, ipms=%d, poll=%d\n", targetticks, ticks, ticks-targetticks, gv.instpermsec, devpoll[device]); #endif /* if the clock gets way out of whack (eg, because of a host @@ -1629,7 +1629,7 @@ int devcp (int class, int func, int device) { XXX: this code should probably be done whether or not the clock is running */ -#define IPMTIME 5000 +#define IPMTIME 1000 if ((gv.instcount < previnstcount) || (gv.instcount-previnstcount > gv.instpermsec*IPMTIME)) { if (gv.instcount-previnstcount > gv.instpermsec*IPMTIME) {