summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm/main.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-05-13 19:12:41 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2019-05-13 19:12:41 +0200
commit3b36daa2bb8c0f4169455baf829b9695b520c5fc (patch)
tree9da4980fe24b4464e4e8d4c9698afcd1b9549c0e /sys/src/9/bcm/main.c
parent157d7ebdbd7479b271e7b1df744b2dfc6b5816e9 (diff)
bcm, bcm64: preserve memsize across reboots, avoid trashing atags while parsing cmdline
we override atag memory on reboot, so preserve the memsize learned from atag as *maxmem plan9 variable. the global memsize variable is not needed anymore. avoid trashing the following atag when zero terminating the cmdline string. zero memory after plan9.ini variables.
Diffstat (limited to 'sys/src/9/bcm/main.c')
-rw-r--r--sys/src/9/bcm/main.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/src/9/bcm/main.c b/sys/src/9/bcm/main.c
index 3c5f5695c..3cc30034f 100644
--- a/sys/src/9/bcm/main.c
+++ b/sys/src/9/bcm/main.c
@@ -18,7 +18,6 @@
uintptr kseg0 = KZERO;
Mach* machaddr[MAXMACH];
Conf conf;
-ulong memsize = 128*1024*1024;
void
machinit(void)
@@ -241,7 +240,7 @@ void
confinit(void)
{
int i, userpcnt;
- ulong kpages;
+ ulong kpages, memsize = 0;
uintptr pa;
char *p;
@@ -257,12 +256,10 @@ confinit(void)
else
userpcnt = 0;
- if((p = getconf("*maxmem")) != nil){
+ if(p = getconf("*maxmem"))
memsize = strtoul(p, 0, 0) - PHYSDRAM;
- if (memsize < 16*MB) /* sanity */
- memsize = 16*MB;
- }
-
+ if (memsize < 16*MB) /* sanity */
+ memsize = 16*MB;
getramsize(&conf.mem[0]);
if(conf.mem[0].limit == 0){
conf.mem[0].base = PHYSDRAM;