ref: e9af397dc7a178fba55477e58089723855b3a1af
parent: 01ab07ef729a2dbade38906f4acf2827ea327952
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Feb 6 08:33:27 EST 2021
pc, pc64: warn when running out of conf.mem[] entries in meminit()
--- a/sys/src/9/pc/memory.c
+++ b/sys/src/9/pc/memory.c
@@ -568,13 +568,16 @@
size = memmapsize(base, BY2PG) & ~(BY2PG-1);
if(size == 0)
continue;
+ if(cm >= &conf.mem[nelem(conf.mem)]){
+ print("meminit: out of entries, loosing: %#p (%llud)\n", base, (uvlong)size);
+ continue;
+ }
cm->base = memmapalloc(base, size, BY2PG, MemRAM);
if(cm->base == -1)
continue;
base = cm->base;
cm->npage = size/BY2PG;
- if(++cm >= &conf.mem[nelem(conf.mem)])
- break;
+ cm++;
}
if(0) memmapdump();