M ip/devip.c => ip/devip.c +1 -1
@@ 511,7 511,7 @@ ipclose(Chan* c)
enum
{
- Statelen= 1024,
+ Statelen= 32*1024,
};
static long
M ip/ipifc.c => ip/ipifc.c +7 -16
@@ 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;
}
M pc/archgeneric.c => pc/archgeneric.c +1 -0
@@ 223,6 223,7 @@ cycletimer(uvlong *hz)
uvlong tsc;
rdmsr(0x10, (vlong*)&tsc);
+ m->fastclock = tsc;
if(hz != nil)
*hz = fasthz;
return tsc;
M pc/clock.c => pc/clock.c +1 -0
@@ 38,6 38,7 @@ clockintr(Ureg* ureg, void*)
{
Clock0link *lp;
+ fastticks(nil);
m->ticks++;
if(m->proc)
m->proc->pc = ureg->pc;
M pc/dat.h => pc/dat.h +1 -1
@@ 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];
};
M pc/mp.c => pc/mp.c +1 -5
@@ 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);