~kris/9p

9hist

be4030a022992b4e050b30853bcf540d00ec7156 — David du Colombier 24 years ago d0f6f9a
Plan 9 from Bell Labs 2002-07-19
2 files changed, 8 insertions(+), 6 deletions(-)

M ip/il.c
M pc/apic.c
M ip/il.c => ip/il.c +1 -1
@@ 417,7 417,7 @@ ilkick(void *x)
static void
ilcreate(Conv *c)
{
	c->rq = qopen(64*1024, Qmsg, 0, c);
	c->rq = qopen(64*1024, 0, 0, c);
	c->wq = qopen(64*1024, Qkick, ilkick, c);
}


M pc/apic.c => pc/apic.c +7 -5
@@ 94,7 94,7 @@ struct
	uvlong	hz;
	ulong	max;
	ulong	min;
	ulong	mult;	/* factor to mutiply fast ticks by to get lapicticks<<16 */
	ulong	div;
} lapictimer;

static int


@@ 149,7 149,10 @@ lapictimerinit(void)
		lapictimer.hz = (0xffffffffUL-lapicr(LapicTCCR))*10;
		lapictimer.max = lapictimer.hz/HZ;
		lapictimer.min = lapictimer.hz/(100*HZ);
		lapictimer.mult = (lapictimer.hz<<16)/hz;

		if(lapictimer.hz > hz)
			panic("lapic clock faster than cpu clock");
		lapictimer.div = hz/lapictimer.hz;
	}
}



@@ 351,18 354,17 @@ lapictimerset(uvlong next)

	x = splhi();
	lock(&m->apictimerlock);

	period = lapictimer.max;
	if(next != 0){
		period = next - fastticks(nil);
		period *= lapictimer.mult;
		period >>= 16;
		period /= lapictimer.div;

		if(period < lapictimer.min)
			period = lapictimer.min;
		else if(period > lapictimer.max - lapictimer.min)
			period = lapictimer.max;
	}

	lapicw(LapicTICR, period);

	unlock(&m->apictimerlock);