M carrera/dat.h => carrera/dat.h +0 -9
@@ 85,15 85,6 @@ struct Notsave
#include "../port/portdat.h"
-#define NCALLBACK 32
-
-typedef struct Callbk Callbk;
-struct Callbk
-{
- void (*func)(void*);
- void* arg;
-};
-
/* First FOUR members offsets known by l.s */
struct Mach
{
M carrera/fns.h => carrera/fns.h +1 -0
@@ 133,6 133,7 @@ void audiodmaintr(void);
ulong fwblock(void*, void*, ulong);
ulong frblock(void*, void*, ulong);
void ifree(void*);
+void ifflush(void*);
Block* iallocb(int);
void* ifroute(ulong);
ulong ifunroute(ulong);
M pc/dat.h => pc/dat.h +4 -6
@@ 114,8 114,6 @@ struct Notsave
* machine dependent definitions not used by ../port/dat.h
*/
-#define NCALLBACK 32
-
struct Mach
{
int machno; /* physical id of processor */
@@ 129,10 127,10 @@ struct Mach
Schedq hiq;
Schedq loq;
- void (**cbin)(void);
- void (**cbout)(void);
- void (**cbend)(void);
- void (*calls[NCALLBACK])(void);
+ Callbk* cbin;
+ Callbk* cbout;
+ Callbk* cbend;
+ Callbk calls[NCALLBACK];
int tlbfault;
int tlbpurge;
M pc/devlpt.c => pc/devlpt.c +12 -7
@@ 197,13 197,18 @@ lptwrite(Chan *c, void *a, long n)
static void
outch(int base, int c)
{
- int status = inb(base+Qpsr);
-
- if(!(status & Fselect) || !(status & Fnoerror))
- error(Eio);
- if(!(status & Fnotbusy)){
- outb(base+Qpcr, Finitbar|Fie);
- sleep(&lptrendez, lptready, (void *)base);
+ int status, tries;
+
+ for(tries = 0;; tries++){
+ status = inb(base+Qpsr);
+ if(!(status & Fselect) || !(status & Fnoerror))
+ error(Eio);
+ if(status & Fnotbusy)
+ break;
+ if(tries > 1000){
+ outb(base+Qpcr, Finitbar|Fie);
+ tsleep(&lptrendez, lptready, (void *)base, MS2HZ);
+ }
}
outb(base+Qdlr, c);
outb(base+Qpcr, Finitbar|Fstrobe);
M pc/main.c => pc/main.c +5 -0
@@ 91,6 91,11 @@ machinit(void)
memset(m, 0, sizeof(Mach));
m->machno = n;
m->mmask = 1<<m->machno;
+
+ /* Setup call back ring buffer */
+ m->cbin = m->calls;
+ m->cbout = m->calls;
+ m->cbend = &m->calls[NCALLBACK];
}
void
M port/devproc.c => port/devproc.c +1 -1
@@ 34,7 34,7 @@ Dirtab procdir[] =
"counters", {Qcounters}, 0, 0444,
"ctl", {Qctl}, 0, 0000,
"fpregs", {Qfpregs}, sizeof(FPsave), 0000,
- "kregs", {Qkregs}, sizeof(Ureg), 0400,
+ "kregs", {Qkregs}, sizeof(Ureg), 0000,
"mem", {Qmem}, 0, 0000,
"note", {Qnote}, 0, 0000,
"noteid", {Qnoteid}, 0, 0666,
M port/portdat.h => port/portdat.h +8 -0
@@ 595,6 595,14 @@ struct Schedq
int n;
};
+#define NCALLBACK 32
+
+typedef struct Callbk Callbk;
+struct Callbk
+{
+ void (*func)(void*);
+ void* arg;
+};
enum
{
M port/qio.c => port/qio.c +1 -2
@@ 415,8 415,7 @@ qread(Queue *q, void *vp, int len)
q->synclen = len;
q->syncbuf = vp;
iunlock(q);
- while(q->syncbuf != 0)
- sleep(&q->rr, filled, q);
+ sleep(&q->rr, filled, q);
len = q->synclen;
poperror();
qunlock(&q->rlock);
M port/qlock.c => port/qlock.c +0 -5
@@ 10,8 10,6 @@ qlock(QLock *q)
{
Proc *p, *mp;
-up->qpc = getcallerpc(0);
-
lock(&q->use);
if(!q->locked) {
q->locked = 1;
@@ 34,7 32,6 @@ up->qpc = getcallerpc(0);
int
canqlock(QLock *q)
{
-up->qpc = getcallerpc(0);
if(!canlock(&q->use))
return 0;
if(q->locked){
@@ 51,8 48,6 @@ qunlock(QLock *q)
{
Proc *p;
-if(up==0) { iprint("QUNLOCK at ilevel PC=%lux\n", getcallerpc(0)); for(;;); }
-
lock(&q->use);
p = q->head;
if(p) {