ref: aca053c18add536fb51d05bbfbc6e0147f06c183
parent: 4e94094e941e908008ead1f574003c2ddc3113a0
author: cinap_lenrek <[email protected]>
date: Wed Dec 24 08:37:54 EST 2014
zynq: set mainmem->maxsize so kernel malloc() wont fail after 4MB
--- a/sys/src/9/zynq/main.c
+++ b/sys/src/9/zynq/main.c
@@ -178,6 +178,7 @@
void
confinit(void)
{
+ ulong kmem;
int i;
conf.nmach = 1;
@@ -189,7 +190,13 @@
conf.npage = 0;
for(i = 0; i < nelem(conf.mem); i++)
conf.npage += conf.mem[i].npage = (conf.mem[i].limit - conf.mem[i].base) >> PGSHIFT;
- conf.upages = conf.npage - 100*1024*1024 / BY2PG;
+ kmem = 100*1024*1024;
+ conf.upages = conf.npage - kmem/BY2PG;
+ kmem -= conf.upages*sizeof(Page)
+ + conf.nproc*sizeof(Proc)
+ + conf.nimage*sizeof(Image);
+ mainmem->maxsize = kmem;
+ imagmem->maxsize = kmem - (kmem/10);
}
static uchar *