From 8bec6290a78314dce6ab5b4059f647c2a9f96e67 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 15 Jul 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-07-15 --- gnot/main.c | 7 +++++++ pc/main.c | 6 ++++++ port/alloc.c | 6 ------ port/sysproc.c | 8 +++++--- power/main.c | 6 ++++++ ss/main.c | 6 ++++++ 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/gnot/main.c b/gnot/main.c index 0f43bc3d78302ce263b04adae171c86706527781..0a153d173015d5e7f38b995d47dbdfdf4a764aa9 100644 --- a/gnot/main.c +++ b/gnot/main.c @@ -303,6 +303,8 @@ void confinit(void) { int mul; + ulong ktop; + conf.nmach = 1; if(conf.nmach > MAXMACH) panic("confinit"); @@ -315,6 +317,11 @@ confinit(void) conf.npage = conf.npage0+conf.npage1; conf.upages = (conf.npage*70)/100; + ktop = PGROUND((ulong)end); + ktop = PADDR(ktop); + conf.npage0 -= ktop/BY2PG; + conf.base0 += ktop; + mul = 1 + (conf.npage1>0); conf.nproc = 50*mul; conf.nswap = 4096; diff --git a/pc/main.c b/pc/main.c index fbd032ac83b42cdc08189bcc39d76e6346df860c..a2785e6c9394857b66cab2159d4712c5ccb84f35 100644 --- a/pc/main.c +++ b/pc/main.c @@ -199,6 +199,7 @@ confinit(void) { long x, i, j, *l; int mul; + ulong ktop; /* * the first 640k is the standard useful memory @@ -238,6 +239,11 @@ confinit(void) conf.npage = conf.npage0 + conf.npage1; conf.upages = (conf.npage*70)/100; + ktop = PGROUND((ulong)end); + ktop = PADDR(ktop); + conf.npage0 -= ktop/BY2PG; + conf.base0 += ktop; + /* for meminit() */ conf.topofmem = i*MB; diff --git a/port/alloc.c b/port/alloc.c index 7eda037b3d89b16f8c95ba669d551cadfdd20d12..b3dae245f2a757f664c52a3d87040f79fd956452 100644 --- a/port/alloc.c +++ b/port/alloc.c @@ -79,7 +79,6 @@ static Xalloc xlists; void xinit(void) { - ulong ktop; Hole *h, *eh; int up, np0, np1; @@ -89,11 +88,6 @@ xinit(void) xlists.flist = xlists.hole; - ktop = PGROUND((ulong)end); - ktop = PADDR(ktop); - conf.npage0 -= ktop/BY2PG; - conf.base0 += ktop; - up = conf.upages; np1 = up; if(np1 > conf.npage1) diff --git a/port/sysproc.c b/port/sysproc.c index d6ccadd1a839354589397fbad5b2c31f70cde285..fd61b59b5d797c1d29bf0ab0cba8d4a30823aa69 100644 --- a/port/sysproc.c +++ b/port/sysproc.c @@ -169,13 +169,15 @@ sysrfork(ulong *arg) p->parentpid = parent->pid; if(flag&RFNOWAIT) p->parentpid = 1; + else { + lock(&parent->exl); + parent->nchild++; + unlock(&parent->exl); + } if((flag&RFNOTEG) == 0) p->noteid = parent->noteid; p->fpstate = parent->fpstate; - lock(&parent->exl); - parent->nchild++; - unlock(&parent->exl); pid = p->pid; memset(p->time, 0, sizeof(p->time)); p->time[TReal] = MACHP(0)->ticks; diff --git a/power/main.c b/power/main.c index 31c537c94356f8a6ec2006cf214b82440f04dd95..31a30f7c0b7e32a497a9c3feeca6fedb8a4d09f6 100644 --- a/power/main.c +++ b/power/main.c @@ -490,6 +490,7 @@ void confinit(void) { long x, i, *l; + ulong ktop; /* * copy configuration down from high memory @@ -515,6 +516,11 @@ confinit(void) conf.npage1 = 0; conf.base1 = 0; + ktop = PGROUND((ulong)end); + ktop = PADDR(ktop); + conf.npage0 -= ktop/BY2PG; + conf.base0 += ktop; + conf.upages = (conf.npage*70)/100; i = conf.npage-conf.upages; if(i > (12*MB)/BY2PG) diff --git a/ss/main.c b/ss/main.c index 7426a74a4cd7171b515d3a712a8cba6ac9420ec5..39dbb9d7143b835b183064f70fb072a5fc976117 100644 --- a/ss/main.c +++ b/ss/main.c @@ -190,6 +190,7 @@ void confinit(void) { int mul; + ulong ktop; conf.nmach = 1; if(conf.nmach > MAXMACH) @@ -203,6 +204,11 @@ confinit(void) conf.upages = 1400; + ktop = PGROUND((ulong)end); + ktop = PADDR(ktop); + conf.npage0 -= ktop/BY2PG; + conf.base0 += ktop; + mul = conf.upages/700; conf.nproc = 50*mul;