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

the rounding of base can make it above top, so have to
use signed comparsion.
This commit is contained in:
cinap_lenrek 2014-06-01 06:54:55 +02:00
parent fb97665a14
commit 1427ba3126

View file

@ -278,7 +278,7 @@ preallocpages(void)
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;