M pc/trap.c => pc/trap.c +12 -2
@@ 140,6 140,14 @@ trap(Ureg* ureg)
up->dbgreg = ureg;
}
+{
+ulong x, y;
+
+x = (ulong)&(m->stack[512]);
+y = (ulong)&mach;
+if(y < x) panic("trap: kstack %lux %lux", m->stack, y);
+}
+
v = ureg->trap;
if(ctl = irqctl[v]){
if(ctl->isintr){
@@ 158,8 166,10 @@ trap(Ureg* ureg)
/* preemptive scheduling */
if(ctl->isintr && v != VectorTIMER && v != VectorCLOCK)
- if(up && up->state == Running && anyhigher())
- sched();
+ if(up && up->state == Running)
+ if(anyhigher())
+ if(!active.exiting)
+ sched();
}
else if(v <= 16 && user){
spllo();
M pc/vgaclgd542x.c => pc/vgaclgd542x.c +33 -1
@@ 40,6 40,38 @@ clgd542xpage(VGAscr* scr, int page)
unlock(&scr->devlock);
}
+static ulong
+clgd542xlinear(VGAscr* scr, int* size, int* align)
+{
+ ulong aperture, oaperture;
+ int oapsize, wasupamem;
+ Pcidev *p;
+
+ oaperture = scr->aperture;
+ oapsize = scr->apsize;
+ wasupamem = scr->isupamem;
+ if(wasupamem)
+ upafree(oaperture, oapsize);
+ scr->isupamem = 0;
+
+ if(p = pcimatch(nil, 0x1013, 0)){
+ aperture = p->mem[0].bar & ~0x0F;
+ *size = p->mem[0].size;
+ }
+ else
+ aperture = 0;
+
+ aperture = upamalloc(aperture, *size, *align);
+ if(aperture == 0){
+ if(wasupamem && upamalloc(oaperture, oapsize, 0))
+ scr->isupamem = 1;
+ }
+ else
+ scr->isupamem = 1;
+
+ return aperture;
+}
+
static void
clgd542xdisable(VGAscr*)
{
@@ 244,7 276,7 @@ VGAdev vgaclgd542xdev = {
0,
0,
clgd542xpage,
- 0,
+ clgd542xlinear,
};
VGAcur vgaclgd542xcur = {
M port/alarm.c => port/alarm.c +1 -1
@@ 120,5 120,5 @@ done:
up->alarm = when;
qunlock(&alarms);
- return old;
+ return old;
}
M port/alloc.c => port/alloc.c +5 -5
@@ 65,7 65,7 @@ pooldel(Pool *p, Bhdr *t)
t->fwd->prev = t->prev;
return;
}
-
+
if(t->fwd != t) {
f = t->fwd;
s = t->parent;
@@ 78,7 78,7 @@ pooldel(Pool *p, Bhdr *t)
else
s->right = f;
}
-
+
rp = t->left;
f->left = rp;
if(rp != nil)
@@ 87,7 87,7 @@ pooldel(Pool *p, Bhdr *t)
f->right = rp;
if(rp != nil)
rp->parent = f;
-
+
t->prev->fwd = t->fwd;
t->fwd->prev = t->prev;
return;
@@ 96,7 96,7 @@ pooldel(Pool *p, Bhdr *t)
if(t->left == nil)
rp = t->right;
else {
- if(t->right == nil)
+ if(t->right == nil)
rp = t->left;
else {
f = t;
@@ 230,7 230,7 @@ poolalloc(Pool *p, int size)
t = B2NB(q);
t->size = ns;
B2T(t)->hdr = t;
- pooladd(p, t);
+ pooladd(p, t);
p->cursize += q->size;
if(p->cursize > p->hw)
p->hw = p->cursize;
M port/auth.c => port/auth.c +2 -2
@@ 170,7 170,7 @@ sysfsession(ulong *arg)
}
unlock(&s->send);
- /*
+ /*
* If server requires no ticket, or user is "none", or a ticket
* is already cached, zero the request type
*/
@@ 349,7 349,7 @@ authreply(Session *s, ulong id, Fcall *f)
if(memcmp(cp->a.chal, s->cchal, sizeof(cp->a.chal))){
print("bad returned challenge\n");
error("server lies");
- }
+ }
if(cp->a.id != id){
print("bad returned id\n");
error("server lies");
M port/cache.c => port/cache.c +3 -3
@@ 56,7 56,7 @@ cinit(void)
cache.head = xalloc(sizeof(Mntcache)*NFILE);
m = cache.head;
-
+
for(i = 0; i < NFILE-1; i++) {
m->next = m+1;
m->prev = m-1;
@@ 129,7 129,7 @@ void
ctail(Mntcache *m)
{
/* Unlink and send to the tail */
- if(m->prev)
+ if(m->prev)
m->prev->next = m->next;
else
cache.head = m->next;
@@ 534,7 534,7 @@ cwrite(Chan* c, uchar *buf, int len, vlong off)
for(f = m->list; f; f = f->next) {
if(f->start >= offset)
break;
- p = f;
+ p = f;
}
if(0 && f != 0 && offset < f->start+f->len) {
M port/chan.c => port/chan.c +13 -13
@@ 32,7 32,7 @@ decref(Ref *r)
lock(r);
x = --r->ref;
unlock(r);
- if(x < 0)
+ if(x < 0)
panic("decref");
return x;
@@ 120,12 120,12 @@ chanfree(Chan *c)
*/
if(c->path) {
if (c->path->ref <= 0) {
- char buf[100];
- ptpath(c->path, buf, sizeof(buf));
- print("decref %s\n", buf);
- }
+ char buf[100];
+ ptpath(c->path, buf, sizeof(buf));
+ print("decref %s\n", buf);
+ }
decref(c->path);
- }
+ }
lock(&chanalloc);
c->next = chanalloc.free;
@@ 214,7 214,7 @@ cmount(Chan *new, Chan *old, int flag, char *spec)
* if this is a union mount, add the old
* node to the mount chain.
*/
- if(order != MREPL)
+ if(order != MREPL)
m->mount = newmount(m, old, 0, 0);
}
@@ 342,8 342,8 @@ domount(Chan *c)
nc->xmnt = nc->mnt;
nc->mountid = m->mount->mountid;
cclose(c);
- c = nc;
- break;
+ c = nc;
+ break;
}
poperror();
@@ 412,7 412,7 @@ walk(Chan **cp, char *name, int domnt)
return 0;
}
- if(ac->mnt == nil)
+ if(ac->mnt == nil)
return -1;
c = nil;
@@ 453,7 453,7 @@ walk(Chan **cp, char *name, int domnt)
}
cclose(ac);
*cp = c;
- return 0;
+ return 0;
}
/*
@@ 659,7 659,7 @@ namec(char *name, int amode, int omode, ulong perm)
if(omode == OEXEC)
c->flag &= ~CCACHE;
-
+
c = devtab[c->type]->open(c, omode);
if(omode & OCEXEC)
@@ 671,7 671,7 @@ namec(char *name, int amode, int omode, ulong perm)
case Amount:
/*
* When mounting on an already mounted upon directory,
- * one wants subsequent mounts to be attached to the
+ * one wants subsequent mounts to be attached to the
* original directory, not the replacement.
*/
if(walk(&c, elem, 0) < 0)
M port/dev.c => port/dev.c +2 -2
@@ 235,7 235,7 @@ Return:
return c;
}
-void
+void
devcreate(Chan*, char*, int, ulong)
{
error(Eperm);
@@ 266,7 266,7 @@ devbwrite(Chan *c, Block *bp, ulong offset)
n = devtab[c->type]->write(c, bp->rp, BLEN(bp), offset);
freeb(bp);
- return n;
+ return n;
}
void
M port/devaudio.c => port/devaudio.c +1 -1
@@ 781,7 781,7 @@ audioinit(void)
}
audio.major = 4;
}
-
+
/*
* initialize the mixer
*/
M port/devcons.c => port/devcons.c +1 -1
@@ 101,7 101,7 @@ putstrn0(char *str, int n, int usewrite)
} else {
if(usewrite)
qwrite(printq, str, n);
- else
+ else
qiwrite(printq, str, n);
break;
}
M port/devenv.c => port/devenv.c +2 -2
@@ 56,7 56,7 @@ envopen(Chan *c, int omode)
{
Egrp *eg;
Evalue *e;
-
+
eg = up->egrp;
if(c->qid.path & CHDIR) {
if(omode != OREAD)
@@ 115,7 115,7 @@ envcreate(Chan *c, char *name, int omode, ulong)
e->link = eg->entries;
eg->entries = e;
c->qid = (Qid){e->path, 0};
-
+
qunlock(eg);
poperror();
M port/devmnt.c => port/devmnt.c +13 -13
@@ 106,13 106,13 @@ mntattach(char *muxattach)
c->flag |= CCACHE;
return c;
}
- unlock(m);
+ unlock(m);
}
}
m = mntalloc.mntfree;
if(m != 0)
- mntalloc.mntfree = m->list;
+ mntalloc.mntfree = m->list;
else {
m = malloc(sizeof(Mnt));
if(m == 0) {
@@ 269,7 269,7 @@ mntclone(Chan *c, Chan *nc)
return nc;
}
-static int
+static int
mntwalk(Chan *c, char *name)
{
Mnt *m;
@@ 298,7 298,7 @@ mntwalk(Chan *c, char *name)
return 1;
}
-static void
+static void
mntstat(Chan *c, char *dp)
{
Mnt *m;
@@ 350,7 350,7 @@ mntopen(Chan *c, int omode)
return c;
}
-static void
+static void
mntcreate(Chan *c, char *name, int omode, ulong perm)
{
Mnt *m;
@@ 379,12 379,12 @@ mntcreate(Chan *c, char *name, int omode, ulong perm)
copen(c);
}
-static void
+static void
mntclunk(Chan *c, int t)
{
Mnt *m;
Mntrpc *r;
-
+
m = mntchk(c);
r = mntralloc(c);
if(waserror()){
@@ 448,7 448,7 @@ mntclose(Chan *c)
mntclunk(c, Tclunk);
}
-static void
+static void
mntremove(Chan *c)
{
mntclunk(c, Tremove);
@@ 474,13 474,13 @@ mntwstat(Chan *c, char *dp)
mntfree(r);
}
-long
+long
mntread9p(Chan *c, void *buf, long n, vlong off)
{
return mnt9prdwr(Tread, c, buf, n, off);
}
-static long
+static long
mntread(Chan *c, void *buf, long n, vlong off)
{
uchar *p, *e;
@@ 517,13 517,13 @@ mntread(Chan *c, void *buf, long n, vlong off)
return n;
}
-long
+long
mntwrite9p(Chan *c, void *buf, long n, vlong off)
{
return mnt9prdwr(Twrite, c, buf, n, off);
}
-static long
+static long
mntwrite(Chan *c, void *buf, long n, vlong off)
{
return mntrdwr(Twrite, c, buf, n, off);
@@ 641,7 641,7 @@ mountrpc(Mnt *m, Mntrpc *r)
break;
print("mnt: proc %s %d: mismatch rep 0x%lux T%d R%d rq %d fls %d rp %d\n",
up->text, up->pid,
- r, r->request.type, r->reply.type, r->request.tag,
+ r, r->request.type, r->reply.type, r->request.tag,
r->flushtag, r->reply.tag);
error(Emountrpc);
}
M port/devns16552.c => port/devns16552.c +7 -7
@@ 253,7 253,7 @@ ns16552fifoon(Uart *p)
if(uartrdreg(p, Data))
;
}
-
+
/* turn on fifo */
p->fifoon = 1;
uartwrreg(p, Fifoctl, Fena|Ftrig);
@@ 262,7 262,7 @@ ns16552fifoon(Uart *p)
/* didn't work, must be an earlier chip type */
p->nofifo = 1;
}
-
+
splx(x);
}
@@ 555,7 555,7 @@ ns16552intr(int dev)
if(l & Oerror)
p->overrun++;
break;
-
+
case 4: /* received data available */
case 12:
ch = uartrdreg(p, Data) & 0xff;
@@ 579,11 579,11 @@ ns16552intr(int dev)
iunlock(&p->rlock);
}
break;
-
+
case 2: /* transmitter not full */
ns16552kick(p);
break;
-
+
case 0: /* modem status */
ch = uartrdreg(p, Mstat);
if(ch & Ctsc){
@@ 595,7 595,7 @@ ns16552intr(int dev)
iunlock(&p->tlock);
}
break;
-
+
default:
if(s&1)
return;
@@ 844,7 844,7 @@ ns16552ctl(Uart *p, char *cmd)
ns16552break(p, 0);
return;
}
-
+
n = atoi(cmd+1);
switch(*cmd){
M port/devpipe.c => port/devpipe.c +1 -1
@@ 220,7 220,7 @@ pipeclose(Chan *c)
}
}
-
+
/*
* if both sides are closed, they are reusable
*/
M port/devproc.c => port/devproc.c +2 -2
@@ 926,10 926,10 @@ procctlmemio(Proc *p, ulong offset, int n, void *va, int read)
poperror();
pte = s->map[soff/PTEMAPMEM];
if(pte == 0)
- panic("procctlmemio");
+ panic("procctlmemio");
pg = pte->pages[(soff&(PTEMAPMEM-1))/BY2PG];
if(pagedout(pg))
- panic("procctlmemio1");
+ panic("procctlmemio1");
l = BY2PG - (offset&(BY2PG-1));
if(n > l)
M port/devroot.c => port/devroot.c +9 -9
@@ 16,7 16,7 @@ enum{
Qrecover,
Qboot, /* readable files */
- Nfiles=13, /* max root files */
+ Nfiles=13, /* max root files */
};
extern ulong bootlen;
@@ 44,7 44,7 @@ struct Recover
Recover *next;
};
-struct
+struct
{
Lock;
QLock;
@@ 59,7 59,7 @@ void
addrootfile(char *name, uchar *contents, ulong len)
{
Dirtab *d;
-
+
if(nroot >= Nfiles)
panic("too many root files");
@@ 84,7 84,7 @@ rootattach(char *spec)
return devattach('/', spec);
}
-static int
+static int
rootwalk(Chan *c, char *name)
{
if(strcmp(name, "..") == 0) {
@@ 96,7 96,7 @@ rootwalk(Chan *c, char *name)
return devwalk(c, name, rootdir, nroot, devgen);
}
-static void
+static void
rootstat(Chan *c, char *dp)
{
devstat(c, dp, rootdir, nroot, devgen);
@@ 110,7 110,7 @@ rootopen(Chan *c, int omode)
break;
case Qrecover:
if(recovbusy)
- error(Einuse);
+ error(Einuse);
if(strcmp(up->user, eve) != 0)
error(Eperm);
recovbusy = 1;
@@ 123,7 123,7 @@ rootopen(Chan *c, int omode)
/*
* sysremove() knows this is a nop
*/
-static void
+static void
rootclose(Chan *c)
{
switch(c->qid.path) {
@@ 142,7 142,7 @@ rdrdy(void*)
return reclist.q != 0;
}
-static long
+static long
rootread(Chan *c, void *buf, long n, vlong off)
{
ulong t;
@@ 193,7 193,7 @@ rootread(Chan *c, void *buf, long n, vlong off)
return n;
}
-static long
+static long
rootwrite(Chan *c, void *buf, long n, vlong)
{
char tmp[256];
M port/devsd.c => port/devsd.c +1 -1
@@ 189,7 189,7 @@ sdattach(char *spec)
sdrdpart(&disk[i]);
qunlock(&disk[i]);
}
-
+
return devattach('w', spec);
}
M port/devssl.c => port/devssl.c +2 -2
@@ 827,7 827,7 @@ sslwrite(Chan *c, void *a, long n, vlong off)
m = e - p;
if(m > s.s->max)
m = s.s->max;
-
+
b.b = allocb(m);
if(waserror()){
freeb(b.b);
@@ 836,7 836,7 @@ sslwrite(Chan *c, void *a, long n, vlong off)
memmove(b.b->wp, p, m);
poperror();
b.b->wp += m;
-
+
sslbwrite(c, b.b, offset);
p += m;
M port/fault.c => port/fault.c +13 -13
@@ 61,7 61,7 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
addr &= ~(BY2PG-1);
soff = addr-s->base;
p = &s->map[soff/PTEMAPMEM];
- if(*p == 0)
+ if(*p == 0)
*p = ptealloc();
etp = *p;
@@ 81,7 81,7 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
case SG_TEXT: /* Demand load */
if(pagedout(*pg))
pio(s, addr, soff, pg);
-
+
mmuphys = PPN((*pg)->pa) | PTERONLY|PTEVALID;
(*pg)->modref = PG_REF;
break;
@@ 92,15 92,15 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
lkp = *pg;
lock(lkp);
- if(lkp->image)
- duppage(lkp);
+ if(lkp->image)
+ duppage(lkp);
unlock(lkp);
goto done;
case SG_BSS:
case SG_SHARED: /* Zero fill on demand */
case SG_STACK:
- case SG_MAP:
+ case SG_MAP:
if(*pg == 0) {
if(type == SG_MAP) {
sprint(buf, "map 0x%lux %c", va, read ? 'r' : 'w');
@@ 142,9 142,9 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
/* put a duplicate of a text page back onto
* the free list
*/
- if(lkp->image)
- duppage(lkp);
-
+ if(lkp->image)
+ duppage(lkp);
+
unlock(lkp);
}
done:
@@ 211,7 211,7 @@ pio(Segment *s, ulong addr, ulong soff, Page **p)
new = newpage(0, 0, addr);
k = kmap(new);
kaddr = (char*)VA(k);
-
+
if(loadrec == 0) { /* This is demand load */
c = s->image->c;
while(waserror()) {
@@ 240,7 240,7 @@ pio(Segment *s, ulong addr, ulong soff, Page **p)
cachepage(new, s->image);
*p = new;
}
- else
+ else
putpage(new);
}
else { /* This is paged out */
@@ 301,14 301,14 @@ okaddr(ulong addr, ulong len, int write)
pprint("suicide: invalid address 0x%lux in sys call pc=0x%lux\n", addr, userpc());
return 0;
}
-
+
void
validaddr(ulong addr, ulong len, int write)
{
if(!okaddr(addr, len, write))
pexit("Suicide", 0);
}
-
+
/*
* &s[0] is known to be a valid address.
*/
@@ 348,7 348,7 @@ seg(Proc *p, ulong addr, int dolock)
if(addr >= n->base && addr < n->top) {
if(dolock == 0)
return n;
-
+
qlock(&n->lk);
if(addr >= n->base && addr < n->top)
return n;
M port/page.c => port/page.c +11 -11
@@ 103,8 103,8 @@ retry:
/*
* If called from fault and we lost the segment from
- * underneath don't waste time allocating and freeing
- * a page. Fault will call newpage again when it has
+ * underneath don't waste time allocating and freeing
+ * a page. Fault will call newpage again when it has
* reacquired the segment locks
*/
if(dontalloc)
@@ 125,7 125,7 @@ retry:
ct = PG_NEWCOL;
}
- if(p->prev)
+ if(p->prev)
p->prev->next = p->next;
else
palloc.head = p->next;
@@ 259,7 259,7 @@ duppage(Page *p) /* Always call with p locked */
/* No freelist cache when memory is very low */
if(palloc.freecount < swapalloc.highwater) {
unlock(&palloc);
- uncachepage(p);
+ uncachepage(p);
return;
}
@@ 271,11 271,11 @@ duppage(Page *p) /* Always call with p locked */
/* No page of the correct color */
if(np == 0) {
unlock(&palloc);
- uncachepage(p);
+ uncachepage(p);
return;
}
- if(np->prev)
+ if(np->prev)
np->prev->next = np->next;
else
palloc.head = np->next;
@@ 305,7 305,7 @@ duppage(Page *p) /* Always call with p locked */
unlock(np);
return;
}
-
+
uncachepage(np);
np->va = p->va;
np->daddr = p->daddr;
@@ 407,7 407,7 @@ lookpage(Image *i, ulong daddr)
lock(&palloc);
if(++f->ref == 1) {
- if(f->prev)
+ if(f->prev)
f->prev->next = f->next;
else
palloc.head = f->next;
@@ 422,7 422,7 @@ lookpage(Image *i, ulong daddr)
unlock(&palloc);
unlock(f);
- return f;
+ return f;
}
}
unlock(&palloc.hashlock);
@@ 451,7 451,7 @@ ptecpy(Pte *old)
*dst = *src;
}
- return new;
+ return new;
}
Pte*
@@ 487,7 487,7 @@ freepte(Segment *s, Pte *p)
}
for(pg = p->pages; pg < ptop; pg++) {
pt = *pg;
- if(pt == 0)
+ if(pt == 0)
continue;
lock(pt);
ref = --pt->ref;
M port/pgrp.c => port/pgrp.c +2 -2
@@ 71,7 71,7 @@ void
closepgrp(Pgrp *p)
{
Mhead **h, **e, *f, *next;
-
+
if(decref(p) != 0)
return;
@@ 145,7 145,7 @@ pgrpcpy(Pgrp *to, Pgrp *from)
m->copy = n;
pgrpinsert(&order, m);
*link = n;
- link = &n->next;
+ link = &n->next;
}
}
}
M port/portdat.h => port/portdat.h +1 -1
@@ 575,7 575,7 @@ struct Proc
ulong alarm; /* Time of call */
int newtlb; /* Pager has changed my pte's, I must flush */
- ulong rendtag; /* Tag for rendezvous */
+ ulong rendtag; /* Tag for rendezvous */
ulong rendval; /* Value for rendezvous */
Proc *rendhash; /* Hash list for tag values */
M port/print.c => port/print.c +1 -1
@@ 121,7 121,7 @@ loop:
case 0:
*local.out = 0;
return local.out;
-
+
default:
printcol++;
goto common;
M port/proc.c => port/proc.c +8 -8
@@ 63,7 63,7 @@ schedinit(void) /* never returns */
break;
case Moribund:
up->state = Dead;
- /*
+ /*
* Holding locks from pexit:
* procalloc
*/
@@ 244,7 244,7 @@ found:
/*
* p->mach==0 only when process state is saved
*/
- if(p == 0 || p->mach){
+ if(p == 0 || p->mach){
unlock(runq);
goto loop;
}
@@ 507,7 507,7 @@ wakeup(Rendez *r)
if(r->p == p && p->r == r){
r->p = 0;
- if(p->state != Wakeme)
+ if(p->state != Wakeme)
panic("wakeup: state");
p->r = 0;
ready(p);
@@ 551,7 551,7 @@ postnote(Proc *p, int dolock, char *n, int flag)
r = p->r;
if(r){
if(r->p != p || p->r != r || p->state != Wakeme)
- panic("postnote: state");
+ panic("postnote: state %d %d %d", r->p != p, p->r != r, p->state);
r->p = 0;
p->r = 0;
ready(p);
@@ 682,7 682,7 @@ pexit(char *exitstr, int freemem)
while(waserror())
;
-
+
wq = smalloc(sizeof(Waitq));
poperror();
@@ 711,15 711,15 @@ pexit(char *exitstr, int freemem)
* written daemon processes from accumulating lots of wait
* records.
*/
- if(p->pid == up->parentpid && p->state != Broken && p->nwait < 128) {
+ if(p->pid == up->parentpid && p->state != Broken && p->nwait < 128) {
p->nchild--;
p->time[TCUser] += utime;
p->time[TCSys] += stime;
-
+
wq->next = p->waitq;
p->waitq = wq;
p->nwait++;
-
+
wakeup(&p->waitr);
unlock(&p->exl);
}
M port/segment.c => port/segment.c +10 -10
@@ 180,7 180,7 @@ dupseg(Segment **seg, int segno, int share)
n->flushme = s->flushme;
qunlock(&s->lk);
- return n;
+ return n;
}
void
@@ 218,8 218,8 @@ attachimage(int type, Chan *c, ulong base, ulong len)
lock(&imagealloc);
/*
- * Search the image cache for remains of the text from a previous
- * or currently running incarnation
+ * Search the image cache for remains of the text from a previous
+ * or currently running incarnation
*/
for(i = ihash(c->qid.path); i; i = i->hash) {
if(c->qid.path == i->qid.path) {
@@ 234,7 234,7 @@ attachimage(int type, Chan *c, ulong base, ulong len)
unlock(i);
}
}
-
+
/*
* imagereclaim dumps pages from the free list which are cached by image
* structures. This should free some image structures.
@@ 335,10 335,10 @@ putimage(Image *i)
lock(i);
if(--i->ref == 0) {
l = &ihash(i->qid.path);
- i->qid = (Qid){~0, ~0};
+ i->qid = (Qid){~0, ~0};
unlock(i);
c = i->c;
-
+
lock(&imagealloc);
for(f = *l; f; f = f->hash) {
if(f == i) {
@@ 393,7 393,7 @@ ibrk(ulong addr, int seg)
}
addr = s->base;
}
-
+
newtop = PGROUND(addr);
newsize = (newtop-s->base)/BY2PG;
if(newtop < s->top) {
@@ 435,7 435,7 @@ mfreeseg(Segment *s, ulong start, int pages)
j = (soff&(PTEMAPMEM-1))/BY2PG;
for(i = soff/PTEMAPMEM; i < SEGMAPSIZE; i++) {
- if(pages <= 0)
+ if(pages <= 0)
break;
if(s->map[i] == 0) {
pages -= PTEPERTAB-j;
@@ 446,7 446,7 @@ mfreeseg(Segment *s, ulong start, int pages)
pg = s->map[i]->pages[j];
if(pg) {
putpage(pg);
- s->map[i]->pages[j] = 0;
+ s->map[i]->pages[j] = 0;
}
if(--pages == 0)
return;
@@ 467,7 467,7 @@ isoverlap(Proc *p, ulong va, int len)
for(i = 0; i < NSEG; i++) {
ns = p->seg[i];
if(ns == 0)
- continue;
+ continue;
if((newtop > ns->base && newtop <= ns->top) ||
(va >= ns->base && va < ns->top))
return 1;
M port/swap.c => port/swap.c +5 -5
@@ 49,12 49,12 @@ newswap(void)
look = memchr(swapalloc.last, 0, swapalloc.top-swapalloc.last);
if(look == 0)
panic("inconsistent swap");
-
+
*look = 1;
swapalloc.last = look;
swapalloc.free--;
unlock(&swapalloc);
- return (look-swapalloc.swmap) * BY2PG;
+ return (look-swapalloc.swmap) * BY2PG;
}
void
@@ 100,7 100,7 @@ pager(void *junk)
Segment *s;
Proc *p, *ep;
- if(waserror())
+ if(waserror())
panic("pager: os error\n");
p = proctab(0);
@@ 160,7 160,7 @@ loop:
goto loop;
}
-static void
+static void
pageout(Proc *p, Segment *s)
{
int type, i;
@@ 244,7 244,7 @@ canflush(Proc *p, Segment *s)
}
p++;
}
- return 1;
+ return 1;
}
static void
M port/sysfile.c => port/sysfile.c +3 -3
@@ 302,7 302,7 @@ unionread(Chan *c, void *va, long n)
}
/* Error causes component of union to be skipped */
- if(waserror()) {
+ if(waserror()) {
cclose(nc);
goto next;
}
@@ 311,7 311,7 @@ unionread(Chan *c, void *va, long n)
nc->offset = c->offset;
nr = devtab[nc->type]->read(nc, va, n, nc->offset);
/* devdirread e.g. changes it */
- c->offset = nc->offset;
+ c->offset = nc->offset;
poperror();
cclose(nc);
@@ 708,7 708,7 @@ sysunmount(ulong *arg)
cclose(cmount);
if(cmounted)
cclose(cmounted);
- poperror();
+ poperror();
return 0;
}
M port/sysproc.c => port/sysproc.c +9 -9
@@ 80,7 80,7 @@ sysrfork(ulong *arg)
p->nerrlab = 0;
p->slash = up->slash;
p->dot = up->dot;
- incref(p->dot);
+ incref(p->dot);
memmove(p->note, up->note, sizeof(p->note));
p->nnote = up->nnote;
@@ 109,7 109,7 @@ sysrfork(ulong *arg)
}
/* Process groups */
- if(flag & (RFNAMEG|RFCNAMEG)) {
+ if(flag & (RFNAMEG|RFCNAMEG)) {
p->pgrp = newpgrp();
if(flag & RFNAMEG)
pgrpcpy(p->pgrp, up->pgrp);
@@ 144,7 144,7 @@ sysrfork(ulong *arg)
* the scheduler in user mode with the return register zero
*/
forkchild(p, up->dbgreg);
-
+
p->parent = up;
p->parentpid = up->pid;
if(flag&RFNOWAIT)
@@ 217,7 217,7 @@ sysexec(ulong *arg)
}
if(!indir)
strcpy(elem, up->elem);
-
+
n = devtab[tc->type]->read(tc, &exec, sizeof(Exec), 0);
if(n < 2)
error(Ebadexec);
@@ 231,7 231,7 @@ sysexec(ulong *arg)
error(Ebadexec);
break; /* for binary */
}
-
+
/*
* Process #! /bin/sh args ...
*/
@@ 461,7 461,7 @@ syssleep(ulong *arg)
up->priority = 0;
sched();
return 0;
- }
+ }
if(n < TK2MS(1))
n = TK2MS(1);
tsleep(&up->sleep, return0, 0, n);
@@ 471,7 471,7 @@ syssleep(ulong *arg)
long
sysalarm(ulong *arg)
{
- return procalarm(arg[0]);
+ return procalarm(arg[0]);
}
long
@@ 592,7 592,7 @@ syssegdetach(ulong *arg)
for(i = 0; i < NSEG; i++)
if(s = up->seg[i]) {
qlock(&s->lk);
- if((addr >= s->base && addr < s->top) ||
+ if((addr >= s->base && addr < s->top) ||
(s->top == s->base && addr == s->base))
goto found;
qunlock(&s->lk);
@@ 668,7 668,7 @@ sysrendezvous(ulong *arg)
;
ready(p);
unlock(up->rgrp);
- return val;
+ return val;
}
l = &p->rendhash;
}