]> git.lizzy.rs Git - plan9front.git/commit
kernel: get rid of physical page bank array and use conf.mem[] instead
authorcinap_lenrek <cinap_lenrek@felloff.net>
Fri, 2 Apr 2021 18:23:25 +0000 (20:23 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Fri, 2 Apr 2021 18:23:25 +0000 (20:23 +0200)
commit295acd7e0d711cfd2c7c6a1bd45d00c9727f5786
treea1e02ca9b5d210447cee12bf0dfafa8848574a33
parentc77b3ba143da491f020a1c2871a57d10d5b8bf8f
kernel: get rid of physical page bank array and use conf.mem[] instead

We can take advantage of the fact that xinit() allocates
kernel memory from conf.mem[] banks always at the beginning
of a bank, so the separate palloc.mem[] array can be eleminated
as we can calculate the amount of non-kernel memory like:

upages = cm->npage - (PGROUND(cm->klimit - cm->kbase)/BY2PG)

for the number of reserved kernel pages,
we provide the new function: ulong nkpages(Confmem*)

This eleminates the error case of running out of slots in
the array and avoids wasting memory in ports that have simple
memory configurations (compared to pc/pc64).
sys/src/9/pc64/mmu.c
sys/src/9/port/page.c
sys/src/9/port/portdat.h
sys/src/9/port/portfns.h
sys/src/9/port/xalloc.c