diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-19 02:45:58 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-19 02:45:58 +0200 |
commit | 1bd4c243ada35e70ff3c92e4019fb6adcc9b4bdc (patch) | |
tree | e0e543d51a2773bdc3cb35429d5c4aea1b96e8f3 /sys/src/9/port/xalloc.c | |
parent | cb2a55aeb38ffa5ac168485ada6bbc44b4f88c1d (diff) |
kernel: ignore last page at the top of virtual kernel address space for xalloc()
avoding kernel address -BY2PG because of end pointer wrapping to zero.
Diffstat (limited to 'sys/src/9/port/xalloc.c')
-rw-r--r-- | sys/src/9/port/xalloc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/src/9/port/xalloc.c b/sys/src/9/port/xalloc.c index 6db734160..13550d4ba 100644 --- a/sys/src/9/port/xalloc.c +++ b/sys/src/9/port/xalloc.c @@ -71,8 +71,10 @@ xinit(void) /* first give to kernel */ if(n > 0){ m->kbase = (uintptr)KADDR(m->base); - m->klimit = (uintptr)KADDR(m->base+size-1)+1; - xhole(m->base, size); + m->klimit = (uintptr)m->kbase+size; + if(m->klimit == 0) + m->klimit = (uintptr)-BY2PG; + xhole(m->base, m->klimit - m->kbase); kpages -= n; } /* if anything left over, give to user */ |