From 50dc394bd51f80f9e93e730e301958a8e03a0926 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 17 Jun 1990 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1990-06-17 --- gnot/devcons.c | 6 ++++++ gnot/devdk.c | 12 ++++++++++-- gnot/devmnt.c | 26 ++++++++++++-------------- gnot/devpipe.c | 5 +---- gnot/devproc.c | 2 +- gnot/fault.c | 19 +++++++++++++------ gnot/lock.c | 10 ++++------ gnot/main.c | 2 +- port/chan.c | 1 - port/devcons.c | 6 +++++- port/devdk.c | 13 +++++++++++-- port/devmnt.c | 22 +++++++++++----------- port/devpipe.c | 5 +---- port/fault.c | 18 +++++++++++++----- port/page.c | 10 +++++++--- port/proc.c | 34 ++++++++++++++++++++++------------ port/sysfile.c | 1 - power/dat.h | 2 +- power/main.c | 9 +++++++-- 19 files changed, 126 insertions(+), 77 deletions(-) diff --git a/gnot/devcons.c b/gnot/devcons.c index 834f7ad38ff3ce4c43eaa15e4b46798bfc173d3b..0dbecd6d3abf18b67165f64808d319c99ff0b3e0 100644 --- a/gnot/devcons.c +++ b/gnot/devcons.c @@ -188,6 +188,8 @@ echo(int c) return; if(c == 0x15) putstrn("^U\n", 3); + if(c == 0x16) + dumpqueues(); else{ ch = c; putstrn(&ch, 1); @@ -399,6 +401,10 @@ consread(Chan *c, void *buf, long n) case Qrcons: case Qcons: qlock(&kbdq); + if(waserror()){ + qunlock(&kbdq); + nexterror(); + } while(!cangetc(&lineq)){ sleep(&kbdq.r, (int(*)(void*))isbrkc, &kbdq); do{ diff --git a/gnot/devdk.c b/gnot/devdk.c index 4e3f2a168b8635eae52b85dc0ecc06dd880dcad9..25ec0099cf26b1fa5c2f1a986ac487097fab56f0 100644 --- a/gnot/devdk.c +++ b/gnot/devdk.c @@ -66,7 +66,7 @@ struct Dkmsg { #define D_OK 1 /* not used */ #define D_OPEN 2 /* (dkmux to host) connection established */ #define D_FAIL 3 /* (dkmux to host) connection failed */ -#define T_CHG 3 /* linege the status of a connection */ +#define T_CHG 3 /* change the status of a connection */ #define D_CLOSE 1 /* close the connection */ #define D_ISCLOSED 2 /* (dkmux to host) confirm a close */ #define D_CLOSEALL 3 /* (dkmux to host) close all connections */ @@ -1003,7 +1003,7 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine) } /* - * linege state if serving + * change state if serving */ if(type == D_SERV){ lp->state = Llistening; @@ -1075,7 +1075,9 @@ dklisten(Chan *c) n = streamread(dc, dialstr, sizeof(dialstr)-1); DPRINT("returns %d\n", n); if(n <= 0) +{print("bad n\n"); error(0, Eio); +} dialstr[n] = 0; DPRINT("dialstr = %s\n", dialstr); @@ -1085,6 +1087,7 @@ dklisten(Chan *c) n = getfields(dialstr, line, 12, '\n'); if (n < 2) { DPRINT("bad dialstr from dk (1 line)\n"); +print("bad dialstr %d '%s'\n", n, dialstr); error(0, Eio); } @@ -1290,6 +1293,11 @@ dkcsckproc(void *a) dp = (Dk *)a; + /* + * tell datakit we've rebooted. It should close all channels. + */ + dkmesg(dp, T_CHG, D_CLOSEALL, 0, 0); + /* * loop forever listening */ diff --git a/gnot/devmnt.c b/gnot/devmnt.c index 59f6631f682fefa364bca54098208df7ca75ca8e..545c56a74dbd936326bfd5bdd3376655c1c65595 100644 --- a/gnot/devmnt.c +++ b/gnot/devmnt.c @@ -65,6 +65,7 @@ struct struct { Lock; + QLock; MntQ *arena; MntQ *free; }mntqalloc; @@ -141,22 +142,21 @@ mhfree(Mnthdr *mh) } MntQ* -mqalloc(void) +mqalloc(Chan *msg) /* mntqalloc is qlocked */ { MntQ *q; - lock(&mntqalloc); if(q = mntqalloc.free){ /* assign = */ mntqalloc.free = q->next; - unlock(&mntqalloc); lock(q); q->ref = 1; + q->msg = msg; + unlock(q); + incref(msg); q->writer = 0; q->reader = 0; - unlock(q); return q; } - unlock(&mntqalloc); panic("no mntqs\n"); /* there MUST be enough */ } @@ -167,7 +167,7 @@ mqfree(MntQ *mq) lock(mq); if(--mq->ref == 0){ -print("mqfree\n"); +print("mqfree %lux %lux\n", mq->reader, mq->writer); msg = mq->msg; mq->msg = 0; lock(&mntqalloc); @@ -272,6 +272,7 @@ mntattach(char *spec) * Look for queue to same msg channel */ q = mntqalloc.arena; + qlock(&mntqalloc); for(i=0; imsg==cm){ lock(q); @@ -283,11 +284,10 @@ mntattach(char *spec) } unlock(q); } - m->q = mqalloc(); - m->q->msg = cm; - incref(cm); + m->q = mqalloc(cm); out: + qunlock(&mntqalloc); mh = mhalloc(); if(waserror()){ mhfree(mh); @@ -645,7 +645,6 @@ mnterrdequeue(MntQ *q, Mnthdr *mh) /* queue is unlocked */ qlock(q); /* take self from queue if necessary */ if(q->reader == u->p){ /* advance a writer to reader */ -print("err: reader\n"); w = q->writer; if(w){ q->reader = w->p; @@ -656,7 +655,6 @@ print("err: reader\n"); q->writer = 0; } }else{ -print("err: writer\n"); w = q->writer; if(w == mh) q->writer = w->next; @@ -774,7 +772,7 @@ mntxmit(Mnt *m, Mnthdr *mh) qlocked = 0; n = (*devtab[q->msg->type].read)(q->msg, mbr->buf, BUFSIZE); if(convM2S(mbr->buf, &mh->rhdr, n) == 0){ - print("format error in mntxmit\n"); + print("%lux %lux %lux %d format error in mntxmit %s\n", u->p, q->reader, q->writer, n, u->p->text); mnterrdequeue(q, mh); error(0, Ebadmsg); } @@ -798,7 +796,7 @@ mntxmit(Mnt *m, Mnthdr *mh) /* * Hand response to correct recipient */ -if(q->writer == 0) print("response with empty queue\n"); +if(q->writer == 0) print("response with empty queue %d %d %d: %d %d\n", mh->rhdr.type, mh->rhdr.err, mh->rhdr.fid, mh->thdr.type, mh->thdr.fid); for(ow=0,w=q->writer; w; ow=w,w=w->next) if(mh->rhdr.fid == w->thdr.fid && mh->rhdr.type == w->thdr.type+1){ @@ -825,7 +823,7 @@ if(q->writer == 0) print("response with empty queue\n"); qunlock(q); qlocked = 0; if(waserror()){ /* interrupted sleep */ - print("interrupted i/o\n"); + print("%lux interrupted i/o %d %d\n", u->p, mh->thdr.type, mh->thdr.fid); mnterrdequeue(q, mh); nexterror(); } diff --git a/gnot/devpipe.c b/gnot/devpipe.c index 30c47fe2bb46c6176b34e48f1a754fc265d74478..2b960dedca066ece5ed18494ff9ec038a4a79cf2 100644 --- a/gnot/devpipe.c +++ b/gnot/devpipe.c @@ -92,22 +92,19 @@ pipeopen(Chan *c, int omode) void pipecreate(Chan *c, char *name, int omode, ulong perm) { - print("pipecreate\n"); error(0, Egreg); } void piperemove(Chan *c) { - print("piperemove\n"); error(0, Egreg); } void pipewstat(Chan *c, char *db) { - print("pipewstat\n"); - error(0, Egreg); + error(0, Eperm); } void diff --git a/gnot/devproc.c b/gnot/devproc.c index 0a6a4e10bf9c380b4cf9a3dbd0c92e17ccd28b36..f20ee7308d545e2cd873f6e8f48a30af6603d58d 100644 --- a/gnot/devproc.c +++ b/gnot/devproc.c @@ -263,7 +263,7 @@ procread(Chan *c, void *va, long n) } /* u area */ - if(c->offset>=USERADDR && c->offset<=USERADDR+BY2PG){ + if(c->offset>=USERADDR && c->offsetoffset+n > USERADDR+BY2PG) n = USERADDR+BY2PG - c->offset; pg = p->upage; diff --git a/gnot/fault.c b/gnot/fault.c index 01bf2ef5839fe97a751137136c4e95ec457301f0..600b435ffb2361a19e399258f5981d141265d864 100644 --- a/gnot/fault.c +++ b/gnot/fault.c @@ -280,19 +280,26 @@ fault(Ureg *ur, FFrame *f) void validaddr(ulong addr, ulong len, int write) { - Seg *s; + Seg *s, *ns; - if((long)len < 0) - goto Err; - s = seg(u->p, addr); - if(s==0 || addr+len>s->maxva || (write && (s->o->flag&OWRPERM)==0)){ + if((long)len < 0){ Err: pprint("invalid address in sys call pc %lux sp %lux\n", ((Ureg*)UREGADDR)->pc, ((Ureg*)UREGADDR)->sp); postnote(u->p, 1, "bad address", NDebug); error(0, Ebadarg); } + Again: + s = seg(u->p, addr); + if(s==0) + goto Err; + if(write && (s->o->flag&OWRPERM)==0) + goto Err; + if(addr+len > s->maxva){ + len -= s->maxva - addr; + addr = s->maxva; + goto Again; + } } - /* * &s[0] is known to be a valid address. */ diff --git a/gnot/lock.c b/gnot/lock.c index c7e317607f5a17c3f3589a10e49cb00715678dc4..782cd6ffe43cea8e3edd12dd9a61b72ef64e89a7 100644 --- a/gnot/lock.c +++ b/gnot/lock.c @@ -4,7 +4,7 @@ #include "dat.h" #include "fns.h" -#define PCOFF -2 +#define PCOFF -1 /* * N.B. Ken's compiler generates a TAS instruction for the sequence: @@ -25,13 +25,13 @@ lock(Lock *l) */ if(l->key >= 0){ l->key |= 0x80; - l->pc = ((ulong*)&i)[PCOFF]; + l->pc = ((ulong*)&l)[PCOFF]; return; } for(i=0; i<10000000; i++) if(l->key >= 0){ l->key |= 0x80; - l->pc = ((ulong*)&i)[PCOFF]; + l->pc = ((ulong*)&l)[PCOFF]; return; } l->key = 0; @@ -41,11 +41,9 @@ lock(Lock *l) int canlock(Lock *l) { - int i; - if(l->key >= 0){ l->key |= 0x80; - l->pc = ((ulong*)&i)[PCOFF]; + l->pc = ((ulong*)&l)[PCOFF]; return 1; } return 0; diff --git a/gnot/main.c b/gnot/main.c index 6398b23996999700060752f74cf20a37bb15c668..f791f11d29b324acfe3696228ca3fed5c4d1821c 100644 --- a/gnot/main.c +++ b/gnot/main.c @@ -289,7 +289,7 @@ confinit(void) conf.base1 = 16*1024*1024; conf.npage = conf.npage0+conf.npage1; mul = 1 + (conf.npage1>0); - conf.nproc = 32*mul; + conf.nproc = 40*mul; conf.npgrp = 15*mul; conf.npte = 700*mul; conf.nmod = 400*mul; diff --git a/port/chan.c b/port/chan.c index 3e0a52475429d7b71a1e7c7c9316899612e9a068..57f220b743f5b3914caeb826d44b13fdc3447855 100644 --- a/port/chan.c +++ b/port/chan.c @@ -127,7 +127,6 @@ mountsplit(Mount *omnt) { Mount *nmnt; - print("mount copy on write\n"); nmnt = newmount(); lock(nmnt); nmnt->term = omnt->term; diff --git a/port/devcons.c b/port/devcons.c index 4324ec30fb5077ff22334ce718792f8401409c66..c2575ff94c25ddfa2e9104937fbf4fde778b96a9 100644 --- a/port/devcons.c +++ b/port/devcons.c @@ -425,6 +425,10 @@ consread(Chan *c, void *buf, long n) case Qcons: qlock(&kbdq); + if(waserror()){ + qunlock(&kbdq); + nexterror(); + } while(!cangetc(&lineq)){ sleep(&kbdq.r, (int(*)(void*))isbrkc, &kbdq); do{ @@ -486,7 +490,7 @@ consread(Chan *c, void *buf, long n) return readnum(c->offset, buf, n, u->p->parentpid, NUMSIZE); case Qtime: - return readnum(c->offset, buf, n, boottime+TK2MS(MACHP(0)->ticks), 12); + return readnum(c->offset, buf, n, boottime+TK2SEC(MACHP(0)->ticks), 12); case Quser: return readstr(c->offset, buf, n, u->p->pgrp->user); diff --git a/port/devdk.c b/port/devdk.c index 4e3f2a168b8635eae52b85dc0ecc06dd880dcad9..2d8b52612d1455bb339e13e6231ccb123dea19d4 100644 --- a/port/devdk.c +++ b/port/devdk.c @@ -66,7 +66,7 @@ struct Dkmsg { #define D_OK 1 /* not used */ #define D_OPEN 2 /* (dkmux to host) connection established */ #define D_FAIL 3 /* (dkmux to host) connection failed */ -#define T_CHG 3 /* linege the status of a connection */ +#define T_CHG 3 /* change the status of a connection */ #define D_CLOSE 1 /* close the connection */ #define D_ISCLOSED 2 /* (dkmux to host) confirm a close */ #define D_CLOSEALL 3 /* (dkmux to host) close all connections */ @@ -1003,7 +1003,7 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine) } /* - * linege state if serving + * change state if serving */ if(type == D_SERV){ lp->state = Llistening; @@ -1075,7 +1075,9 @@ dklisten(Chan *c) n = streamread(dc, dialstr, sizeof(dialstr)-1); DPRINT("returns %d\n", n); if(n <= 0) +{print("bad n\n"); error(0, Eio); +} dialstr[n] = 0; DPRINT("dialstr = %s\n", dialstr); @@ -1085,6 +1087,7 @@ dklisten(Chan *c) n = getfields(dialstr, line, 12, '\n'); if (n < 2) { DPRINT("bad dialstr from dk (1 line)\n"); +print("bad dialstr %d '%s'\n", n, dialstr); error(0, Eio); } @@ -1290,6 +1293,12 @@ dkcsckproc(void *a) dp = (Dk *)a; + /* + * tell datakit we've rebooted. It should close all channels. + */ + dkmesg(dp, T_ALIVE, D_RESTART, 0, 0); /* do this on mips but not 68020 */ + dkmesg(dp, T_CHG, D_CLOSEALL, 0, 0); + /* * loop forever listening */ diff --git a/port/devmnt.c b/port/devmnt.c index 1e4ccae05b5a858b6a52a706ebb7c1393a4377bd..9709559dad2c8166a84bffde646bc97d63c4c11c 100644 --- a/port/devmnt.c +++ b/port/devmnt.c @@ -141,22 +141,21 @@ mhfree(Mnthdr *mh) } MntQ* -mqalloc(void) +mqalloc(Chan *msg) /* mntqalloc is locked */ { MntQ *q; - lock(&mntqalloc); if(q = mntqalloc.free){ /* assign = */ mntqalloc.free = q->next; - unlock(&mntqalloc); lock(q); q->ref = 1; + q->msg = msg; + unlock(q); + incref(msg); q->writer = 0; q->reader = 0; - unlock(q); return q; } - unlock(&mntqalloc); panic("no mntqs\n"); /* there MUST be enough */ } @@ -167,6 +166,7 @@ mqfree(MntQ *mq) lock(mq); if(--mq->ref == 0){ +print("mqfree %lux %lux\n", mq->reader, mq->writer); msg = mq->msg; mq->msg = 0; lock(&mntqalloc); @@ -271,6 +271,7 @@ mntattach(char *spec) * Look for queue to same msg channel */ q = mntqalloc.arena; + lock(&mntqalloc); for(i=0; imsg==cm){ lock(q); @@ -282,11 +283,10 @@ mntattach(char *spec) } unlock(q); } - m->q = mqalloc(); - m->q->msg = cm; - incref(cm); + m->q = mqalloc(cm); out: + unlock(&mntqalloc); mh = mhalloc(); if(waserror()){ mhfree(mh); @@ -771,7 +771,7 @@ mntxmit(Mnt *m, Mnthdr *mh) qlocked = 0; n = (*devtab[q->msg->type].read)(q->msg, mbr->buf, BUFSIZE); if(convM2S(mbr->buf, &mh->rhdr, n) == 0){ - print("format error in mntxmit\n"); + print("%lux %lux %lux %d format error in mntxmit %s\n", u->p, q->reader, q->writer, n, u->p->text); mnterrdequeue(q, mh); error(0, Ebadmsg); } @@ -795,7 +795,7 @@ mntxmit(Mnt *m, Mnthdr *mh) /* * Hand response to correct recipient */ -if(q->writer == 0) print("response with empty queue\n"); +if(q->writer == 0) print("response with empty queue %d %d %d: %d %d\n", mh->rhdr.type, mh->rhdr.err, mh->rhdr.fid, mh->thdr.type, mh->thdr.fid); for(ow=0,w=q->writer; w; ow=w,w=w->next) if(mh->rhdr.fid == w->thdr.fid && mh->rhdr.type == w->thdr.type+1){ @@ -822,7 +822,7 @@ if(q->writer == 0) print("response with empty queue\n"); qunlock(q); qlocked = 0; if(waserror()){ /* interrupted sleep */ - print("interrupted i/o\n"); + print("%lux interrupted i/o %d %d\n", u->p, mh->thdr.type, mh->thdr.fid); mnterrdequeue(q, mh); nexterror(); } diff --git a/port/devpipe.c b/port/devpipe.c index 30c47fe2bb46c6176b34e48f1a754fc265d74478..2b960dedca066ece5ed18494ff9ec038a4a79cf2 100644 --- a/port/devpipe.c +++ b/port/devpipe.c @@ -92,22 +92,19 @@ pipeopen(Chan *c, int omode) void pipecreate(Chan *c, char *name, int omode, ulong perm) { - print("pipecreate\n"); error(0, Egreg); } void piperemove(Chan *c) { - print("piperemove\n"); error(0, Egreg); } void pipewstat(Chan *c, char *db) { - print("pipewstat\n"); - error(0, Egreg); + error(0, Eperm); } void diff --git a/port/fault.c b/port/fault.c index fb96b97067d8bbd86bf3f699120c666ffd5e237e..086bf45030dc1be718a3bb1970e5ac02aeabf05d 100644 --- a/port/fault.c +++ b/port/fault.c @@ -208,17 +208,25 @@ o->nmod++; void validaddr(ulong addr, ulong len, int write) { - Seg *s; + Seg *s, *ns; - if((long)len < 0) - goto Err; - s = seg(u->p, addr); - if(s==0 || addr+len>s->maxva || (write && (s->o->flag&OWRPERM)==0)){ + if((long)len < 0){ Err: pprint("invalid address in sys call pc %lux sp %lux\n", ((Ureg*)UREGADDR)->pc, ((Ureg*)UREGADDR)->sp); postnote(u->p, 1, "bad address", NDebug); error(0, Ebadarg); } + Again: + s = seg(u->p, addr); + if(s==0) + goto Err; + if(write && (s->o->flag&OWRPERM)==0) + goto Err; + if(addr+len > s->maxva){ + len -= s->maxva - addr; + addr = s->maxva; + goto Again; + } } void diff --git a/port/page.c b/port/page.c index 54663130711145d96a5b062a1da019ed6a592d6b..f7bf7bb6ffc7846a73dc12266b18429e92103bfb 100644 --- a/port/page.c +++ b/port/page.c @@ -10,7 +10,7 @@ struct Lock; ulong addr; int active; - Page *page; /* base of Page structures, indexed by phys addr */ + Page *page; /* base of Page structures, indexed by phys page number */ ulong minppn; /* index of first usable page */ Page *head; /* most recently used */ Page *tail; /* least recently used */ @@ -161,6 +161,7 @@ newpage(int noclear, Orig *o, ulong va) { Page *p; Orig *o1; + KMap *k; if(palloc.active == 0) print("newpage inactive\n"); @@ -206,8 +207,11 @@ loop: p->ref = 1; usepage(p, 0); unlock(&palloc); - if(!noclear) - memset((void*)(p->pa|KZERO), 0, BY2PG); + if(!noclear){ + k = kmap(p); + memset((void*)VA(k), 0, BY2PG); + kunmap(k); + } p->o = o; p->va = va; diff --git a/port/proc.c b/port/proc.c index 83c3dc1bc335f2a74533f6e57dff41e4e16fddc1..06fe95acd5555f7f63a1db936618057e4f79c516 100644 --- a/port/proc.c +++ b/port/proc.c @@ -303,18 +303,23 @@ int postnote(Proc *p, int dolock, char *n, int flag) { User *up; + KMap *k; int s; Rendez *r; if(dolock) lock(&p->debug); - up = (User*)(p->upage->pa|KZERO); + k = kmap(p->upage); + up = (User*)VA(k); if(flag!=NUser && (up->notify==0 || up->notified)) up->nnote = 0; /* force user's hand */ - else if(up->nnote == NNOTE-1) + else if(up->nnote == NNOTE-1){ + kunmap(k); return 0; + } strcpy(up->note[up->nnote].msg, n); up->note[up->nnote++].flag = flag; + kunmap(k); if(dolock) unlock(&p->debug); if(r = p->r){ /* assign = */ @@ -398,7 +403,7 @@ pexit(char *s, int freemem) /* * Pass info through back door, to avoid huge Proc's */ - p->waitmsg = (Waitmsg*)(c->upage->pa|(((ulong)&w)&(BY2PG-1))|KZERO); + p->waitmsg = (((ulong)&w)&(BY2PG-1)); c->state = Exiting; if(p->state == Inwait) ready(p); @@ -499,6 +504,7 @@ ulong pwait(Waitmsg *w) { Proc *c, *p; + KMap *k; ulong cpid; p = u->p; @@ -515,16 +521,17 @@ again: lock(&p->wait.queue); /* wait until child is finished */ c = p->child; if(c == 0){ - print("pwait %d\n", p->pid); p->state = Inwait; unlock(&p->wait.queue); sched(); goto again; } p->child = 0; + k = kmap(c->upage); if(w) - *w = *p->waitmsg; - cpid = p->waitmsg->pid; + *w = *(Waitmsg*)(p->waitmsg|VA(k)); + cpid = ((Waitmsg*)(p->waitmsg|VA(k)))->pid; + kunmap(k); p->time[TCUser] += c->time[TUser] + c->time[TCUser]; p->time[TCSys] += c->time[TSys] + c->time[TCSys]; p->time[TCReal] += c->time[TReal]; @@ -566,25 +573,27 @@ kproc(char *name, void (*func)(void *), void *arg) Proc *p; int n; ulong upa; - User *up; int lastvar; /* used to compute stack address */ + User *up; + KMap *k; /* * Kernel stack */ p = newproc(); p->upage = newpage(1, 0, USERADDR|(p->pid&0xFFFF)); - upa = p->upage->pa|KZERO; - up = (User *)upa; + k = kmap(p->upage); + upa = VA(k); + up = (User*)upa; + up->p = p; /* * Save time: only copy u-> data and useful stack */ - memcpy((void*)upa, u, sizeof(User)); + memcpy(up, u, sizeof(User)); n = USERADDR+BY2PG - (ulong)&lastvar; n = (n+32) & ~(BY2WD-1); /* be safe & word align */ - memcpy((void*)(upa+BY2PG-n), (void*)((u->p->upage->pa|KZERO)+BY2PG-n), n); - ((User *)upa)->p = p; + memcpy((void*)(upa+BY2PG-n), (void*)(USERADDR+BY2PG-n), n); /* * Refs @@ -593,6 +602,7 @@ kproc(char *name, void (*func)(void *), void *arg) for(n=0; n<=up->maxfd; n++) up->fd[n] = 0; up->maxfd = 0; + kunmap(k); /* * Sched diff --git a/port/sysfile.c b/port/sysfile.c index fe41dfde5129630c96bc3836c301c7b105ef1d62..a3f1c6c8a535ee825be9a67316d69830e8662959 100644 --- a/port/sysfile.c +++ b/port/sysfile.c @@ -283,7 +283,6 @@ sysstat(ulong *arg) validaddr(arg[0], 1, 0); c = namec((char*)arg[0], Aaccess, 0, 0); if(waserror()){ -print("stat error\n"); close(c); nexterror(); } diff --git a/power/dat.h b/power/dat.h index d4d7575b7e249ce9ff725be2a81916444598163b..bcfe16b58d518561e20b5ca7cb6ef978066ba345 100644 --- a/power/dat.h +++ b/power/dat.h @@ -310,7 +310,7 @@ struct Proc Proc *sib; /* non-ascendant relatives (circular list) */ int nchild; QLock wait; /* exiting children to be waited for */ - Waitmsg *waitmsg; + ulong waitmsg; Proc *child; Proc *parent; Pgrp *pgrp; diff --git a/power/main.c b/power/main.c index 9e585168e5d1e4b03c0bae124073f309d8d79826..b2a223685d56aa79c3c4200f8915dcb62cd46ec8 100644 --- a/power/main.c +++ b/power/main.c @@ -199,6 +199,7 @@ userinit(void) Proc *p; Seg *s; User *up; + KMap *k; int i; char **av; @@ -219,8 +220,10 @@ userinit(void) /* * User */ - up = (User*)(p->upage->pa|KZERO); + k = kmap(p->upage); + up = (User*)VA(k); up->p = p; + kunmap(k); /* * User Stack, pass input arguments to boot process @@ -244,7 +247,9 @@ userinit(void) s->proc = p; s->o = neworig(UTZERO, 1, 0, 0); s->o->pte[0].page = newpage(0, 0, UTZERO); - memcpy((ulong*)(s->o->pte[0].page->pa|KZERO), initcode, sizeof initcode); + k = kmap(s->o->pte[0].page); + memcpy((ulong*)VA(k), initcode, sizeof initcode); + kunmap(k); s->minva = 0x1000; s->maxva = 0x2000;