git: 9front

Download patch

ref: 58fee0acf8ed585ff75c7c1638e28bff329d9732
parent: 179f676f93c3a6dcaa356f82615c1bb46607c89e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 1 02:54:55 EDT 2014

pc64: fix for unsigned comparsion of (top - base) >= size

the rounding of base can make it above top, so have to
use signed comparsion.

--- a/sys/src/9/pc64/main.c
+++ b/sys/src/9/pc64/main.c
@@ -278,7 +278,7 @@
 		pm = &palloc.mem[i];
 		base = ROUND(pm->base, PGLSZ(1));
 		top = pm->base + (uvlong)pm->npage * BY2PG;
-		if((base + size) <= VMAPSIZE && (top - base) >= size){
+		if((base + size) <= VMAPSIZE && (vlong)(top - base) >= size){
 			va = base + VMAP;
 			pmap(m->pml4, base | PTEGLOBAL|PTEWRITE|PTEVALID, va, size);
 			palloc.pages = (Page*)va;
--