mm: Allow dev.mmap() to block
[akaros.git] / kern / src / pagemap.c
index bda2f02..ae69a84 100644 (file)
@@ -282,6 +282,9 @@ static bool vmr_has_page_idx(struct vm_region *vmr, unsigned long pg_idx)
 {
        unsigned long nr_pgs = (vmr->vm_end - vmr->vm_base) >> PGSHIFT;
        unsigned long start_pg = vmr->vm_foff >> PGSHIFT;
+
+       if (!vmr->vm_ready)
+               return false;
        return ((start_pg <= pg_idx) && (pg_idx < start_pg + nr_pgs));
 }
 
@@ -618,7 +621,8 @@ void print_page_map_info(struct page_map *pm)
        TAILQ_FOREACH(vmr_i, &pm->pm_vmrs, vm_pm_link) {
                printk("\tVMR proc %d: (%p - %p): 0x%08x, 0x%08x, %p, %p\n",
                       vmr_i->vm_proc->pid, vmr_i->vm_base, vmr_i->vm_end,
-                      vmr_i->vm_prot, vmr_i->vm_flags, vmr_i->vm_file, vmr_i->vm_foff);
+                      vmr_i->vm_prot, vmr_i->vm_flags, foc_pointer(vmr_i->__vm_foc),
+                          vmr_i->vm_foff);
        }
        spin_unlock(&pm->pm_lock);
 }