~kris/9p

9hist

fa1308e9f1b104ad0fd3536dc90205f2a630ec63 — David du Colombier 24 years ago e6f6e84
Plan 9 from Bell Labs 2002-03-29
6 files changed, 19 insertions(+), 26 deletions(-)

M pc/trap.c
M port/devrealtime.c
M port/edf.c
M port/portdat.h
M port/proc.c
M port/segment.c
M pc/trap.c => pc/trap.c +1 -15
@@ 303,21 303,7 @@ trap(Ureg* ureg)
		postnote(up, 1, buf, NDebug);
	}
	else if(vno >= VectorPIC && vno != VectorSYSCALL){
		/* call all interrupt routines, just in case */
		for(i = VectorPIC; i <= MaxIrqLAPIC; i++){
			ctl = vctl[i];
			if(ctl == nil)
				continue;
			if(!ctl->isintr)
				continue;
			for(v = ctl; v != nil; v = v->next){
				if(v->f)
					v->f(ureg, v->a);
			}
			/* should we do this? */
			if(ctl->eoi)
				ctl->eoi(i);
		}
		i8259isr(vno);
			
		/*
		 * An unknown interrupt.

M port/devrealtime.c => port/devrealtime.c +13 -1
@@ 57,6 57,18 @@ Dirtab scheddir[]={
	"time",		{Qtime},				0,	0444,
};

static char *schedstatename[] = {
	[SRelease] =	"Release",
	[SRun] =		"Run",
	[SPreempt] =	"Preempt",
	[SBlock] =		"Block",
	[SResume] =	"Resume",
	[SDeadline] =	"Deadline",
	[SYield] =		"Yield",
	[SSlice] =		"Slice",
	[SExpel] =		"Expel",
};

static char*
dumptask(char *p, char *e, Task *t, Ticks now)
{


@@ 169,7 181,7 @@ _devrt(Task *t, Ticks t1, SEvent etype)
	if (logopens.ref == 0 || nevents == Nevents)
		return;

	if(edfprint)iprint("state %s\n", edf_statename[etype]);
	if(edfprint)iprint("state %s\n", schedstatename[etype]);
	events[wevent].tid = t - tasks;
	events[wevent].ts = 0;
	if (t1)

M port/edf.c => port/edf.c +2 -9
@@ 29,7 29,6 @@ char *edf_statename[] = {
static Cycintr	cycdeadline;		/* Time of next deadline */
static Cycintr	cycrelease;		/* Time of next release */

static Ticks	utilization;		/* Current utilization */
static int		initialized;
static uvlong	fasthz;	
static Ticks	now;


@@ 154,12 153,10 @@ edfenqueue(Taskq *q, Task *t)
{
	Task *tt, **ttp;

	ilock(q);
	DPRINT("%d edfenqueue, %s, %d\n", m->machno, edf_statename[t->state], t->runq.n);
	t->rnext = nil;
	if (q->head == nil) {
		q->head = t;
		iunlock(q);
		return t;
	}
	SET(tt);


@@ 175,7 172,6 @@ edfenqueue(Taskq *q, Task *t)
		tt->rnext = t;
	if (t != q->head)
		t = nil;
	iunlock(q);
	return t;
}



@@ 185,12 181,10 @@ edfdequeue(Taskq *q)
	Task *t;

	DPRINT("%d edfdequeue\n", m->machno);
	ilock(q);
	if (t = q->head){
		q->head = t->rnext;
		t->rnext = nil;
	}
	iunlock(q);
	return t;
}



@@ 199,17 193,14 @@ edfqremove(Taskq *q, Task *t)
{
	Task **tp;

	ilock(q);
	DPRINT("%d edfqremove, %s, %d\n", m->machno, edf_statename[t->state], t->runq.n);
	for (tp = &q->head; *tp; tp = &(*tp)->rnext){
		if (*tp == t){
			*tp = t->rnext;
			t = (tp == &q->head) ? q->head : nil;
			iunlock(q);
			return t;
		}
	}
	iunlock(q);
	return nil;
}



@@ 482,6 473,8 @@ edfdeadlineintr(Ureg*, Cycintr*)
				}	
			}
		}
		if (up->nlocks)
			iprint("have %lud locks at deadline\n", up->nlocks);
	}
	iunlock(&edflock);
	sched();

M port/portdat.h => port/portdat.h +1 -0
@@ 640,6 640,7 @@ struct Proc
	Mach	*wired;
	Mach	*mp;		/* machine this process last ran on */
	ulong	nlocks;	/* number of locks held by proc */
	ulong	delaysched;
	ulong	priority;	/* priority level */
	ulong	basepri;	/* base priority level */
	uchar	fixedpri;	/* priority level deson't change */

M port/proc.c => port/proc.c +1 -1
@@ 514,7 514,7 @@ ms2tk(ulong ms)
	/* avoid overflows at the cost of precision */
	if(ms >= 1000000000/HZ)
		return (ms/1000)*HZ;
	return (ms+500)*HZ/1000;
	return (ms*HZ+500)/1000;
}

void

M port/segment.c => port/segment.c +1 -0
@@ 125,6 125,7 @@ putseg(Segment *s)
		free(s->map);
	if(s->profile != 0)
		free(s->profile);
	unlock(s);	/* keep lock/unlocks balanced */
	free(s);
}