code: plan9front

Download patch

ref: 0dab8869adf16f425b0cbd13eef1a8df4d2823f0
parent: fd8597ac315b3be5f5bdb85445345a7ba4627c15
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jun 18 08:15:33 EDT 2015

kernel: ignore memory pages with singular kernel addresses

addresses va's of 0 and -BY2PG cause trouble with some memmove()/memset()
implementations and possibly other code because of the nil pointer
and end pointers wrapping to zero.

--- a/sys/src/9/port/page.c
+++ b/sys/src/9/port/page.c
@@ -36,6 +36,8 @@
 		for(j=0; j<pm->npage; j++){
 			memset(p, 0, sizeof *p);
 			p->pa = pm->base+j*BY2PG;
+			if(cankaddr(p->pa) && (KADDR(p->pa) == nil || KADDR(p->pa) == (void*)-BY2PG))
+				continue;
 			p->color = color;
 			color = (color+1)%NCOLOR;
 			pagechainhead(p);