+ // if mfile is set, then it is a mem map
+ if (hit_region->mfile) {
+ struct v_file* file = hit_region->mfile;
+ u32_t offset =
+ (ptr - hit_region->start) & (PG_SIZE - 1) + hit_region->offset;
+ uintptr_t pa = pmm_alloc_page(__current->pid, 0);
+
+ if (!pa) {
+ goto oom;
+ }
+
+ cpu_invplg(pte);
+ *pte = *pte | pa | PG_PRESENT;
+ int errno = file->ops->read_page(
+ file->inode, ptr & (PG_SIZE - 1), PG_SIZE, offset);
+ if (errno < 0) {
+ kprintf(KERROR "fail to read page (%d)\n", errno);
+ goto segv_term;
+ }
+ goto resolved;
+ }
+