From 3802aeda216d03b69bf46f82707eefab833b96ae Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 17 Jul 1998 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1998-07-17 --- ip/devip.c | 2 +- ip/ipifc.c | 23 +++++++---------------- pc/archgeneric.c | 1 + pc/clock.c | 1 + pc/dat.h | 2 +- pc/mp.c | 6 +----- 6 files changed, 12 insertions(+), 23 deletions(-) diff --git a/ip/devip.c b/ip/devip.c index bfbc364f06864db29d91d4e18d8569a58d11624b..4df73d09da8bc0017ff03bfb16382ecaa237aa90 100644 --- a/ip/devip.c +++ b/ip/devip.c @@ -511,7 +511,7 @@ ipclose(Chan* c) enum { - Statelen= 1024, + Statelen= 32*1024, }; static long diff --git a/ip/ipifc.c b/ip/ipifc.c index a0e353d6ba86ec67886543e89f197f0b6a45ee5c..b5ff1c87ec72c470676d2a574f46a2a265e799cd 100644 --- a/ip/ipifc.c +++ b/ip/ipifc.c @@ -211,7 +211,7 @@ ipifcstate(Conv *c, char *state, int n) m = snprint(state, n, "%-12.12s %-5d", ifc->dev, ifc->maxmtu); rlock(ifc); - for(lifc = ifc->lifc; lifc; lifc = lifc->next) + for(lifc = ifc->lifc; lifc && n > m; lifc = lifc->next) m += snprint(state+m, n - m, " %-20.20I %-20.20M %-20.20I %-7d %-7d %-7d %-7d\n", lifc->local, lifc->mask, lifc->remote, @@ -374,10 +374,6 @@ ipifcadd(Ipifc *ifc, char **argv, int argc) break; } - if(waserror()){ - wunlock(ifc); - panic("ipifcadd"); - } wlock(ifc); /* ignore if this is already a local address for this ifc */ @@ -433,7 +429,6 @@ ipifcadd(Ipifc *ifc, char **argv, int argc) out: wunlock(ifc); - poperror(); return nil; } @@ -457,13 +452,8 @@ ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock) parseip(ip, argv[1]); parseipmask(mask, argv[2]); - if(dolock){ - if(waserror()){ - wunlock(ifc); - nexterror(); - } + if(dolock) wlock(ifc); - } /* find address on this interface and remove from chain */ lifc = nil; @@ -475,8 +465,11 @@ ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock) break; } - if(lifc == nil) + if(lifc == nil){ + if(dolock) + wunlock(ifc); return "address not on this interface"; + } /* disassociate any addresses */ while(lifc->link) @@ -491,10 +484,8 @@ ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock) free(lifc); out: - if(dolock){ + if(dolock) wunlock(ifc); - poperror(); - } return nil; } diff --git a/pc/archgeneric.c b/pc/archgeneric.c index 657dd3b53315ca4f3e157706fcddbec536993046..da1be876a0006d464fb1180edcd2fe9607f39f62 100644 --- a/pc/archgeneric.c +++ b/pc/archgeneric.c @@ -223,6 +223,7 @@ cycletimer(uvlong *hz) uvlong tsc; rdmsr(0x10, (vlong*)&tsc); + m->fastclock = tsc; if(hz != nil) *hz = fasthz; return tsc; diff --git a/pc/clock.c b/pc/clock.c index 3954a5bec32f4a8df34a225f291b2d580205966a..ea116bc6924e6a8edfc710fc9f19bcbaffd7d603 100644 --- a/pc/clock.c +++ b/pc/clock.c @@ -38,6 +38,7 @@ clockintr(Ureg* ureg, void*) { Clock0link *lp; + fastticks(nil); m->ticks++; if(m->proc) m->proc->pc = ureg->pc; diff --git a/pc/dat.h b/pc/dat.h index f91e4d7cabd7d6faa8862738df29956650633a48..ab787ddab5d01d8619598e56c5aa3ce8e2183e8e 100644 --- a/pc/dat.h +++ b/pc/dat.h @@ -187,7 +187,7 @@ struct Mach vlong mtrrfix[11]; vlong mtrrvar[32]; /* 256 max. */ - vlong clockstart; /* starting value for cycle clock */ + vlong fastclock; /* last sampled value */ int stack[1]; }; diff --git a/pc/mp.c b/pc/mp.c index 967afdaaeb7525f725a9fe9ca8c83070702489e0..3fff9b414d0fbb564858210150dba94142ec6f5c 100644 --- a/pc/mp.c +++ b/pc/mp.c @@ -356,9 +356,6 @@ squidboy(Apic* apic) { // iprint("Hello Squidboy\n"); - /* synchronize cycle clocks */ - wrmsr(0x10, m->clockstart); - machinit(); mmuinit(); @@ -374,7 +371,7 @@ squidboy(Apic* apic) * Restrain your octopus! Don't let it go out on the sea! */ while(MACHP(0)->ticks == 0) - ; + wrmsr(0x10, MACHP(0)->fastclock); /* synchronize fast counters */ lapicinit(apic); lapiconline(); @@ -443,7 +440,6 @@ mpstartap(Apic* apic) *p = i>>8; nvramwrite(0x0F, 0x0A); - rdmsr(0x10, &mach->clockstart); lapicstartap(apic, PADDR(APBOOTSTRAP)); for(i = 0; i < 100000; i++){ lock(&mprdthilock);