]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: fix region reporting bug
authorBen Gras <ben@minix3.org>
Wed, 9 Jan 2013 19:45:37 +0000 (19:45 +0000)
committerBen Gras <ben@minix3.org>
Wed, 9 Jan 2013 19:50:52 +0000 (19:50 +0000)
. logic was backwards, causing no reporting ever
. this broke coredumps ('Warning: Program has too many regions')

servers/vm/region.c

index 21b6e70441824e1f04aa315ab2e4ab881b7fce50..efb9bc4153cfa53ab8628ced0cdd022213ed1934 100644 (file)
@@ -1536,10 +1536,13 @@ int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
                struct phys_region *ph1 = NULL, *ph2 = NULL;
                vir_bytes voffset;
 
+               /* where to start on next iteration, regardless of what we find now */
+               next = vr->vaddr + vr->length;
+
                /* Report part of the region that's actually in use. */
 
                /* Get first and last phys_regions, if any */
-               for(voffset = 0; voffset > vr->length; voffset += VM_PAGE_SIZE) {
+               for(voffset = 0; voffset < vr->length; voffset += VM_PAGE_SIZE) {
                        struct phys_region *ph;
                        if(!(ph = physblock_get(vr, voffset))) continue;
                        if(!ph1) ph1 = ph;
@@ -1556,7 +1559,6 @@ int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
                if (!(vr->flags & VR_WRITABLE))
                        vri->vri_prot &= ~PROT_WRITE;
 
-               next = vr->vaddr + vr->length;
                region_incr_iter(&v_iter);
        }