MCPcopy Create free account
hub / github.com/F-Stack/f-stack / exec_map_first_page

Function exec_map_first_page

freebsd/kern/kern_exec.c:985–1015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985int
986exec_map_first_page(struct image_params *imgp)
987{
988 vm_object_t object;
989 vm_page_t m;
990 int error;
991
992 if (imgp->firstpage != NULL)
993 exec_unmap_first_page(imgp);
994
995 object = imgp->vp->v_object;
996 if (object == NULL)
997 return (EACCES);
998#if VM_NRESERVLEVEL > 0
999 if ((object->flags & OBJ_COLORED) == 0) {
1000 VM_OBJECT_WLOCK(object);
1001 vm_object_color(object, 0);
1002 VM_OBJECT_WUNLOCK(object);
1003 }
1004#endif
1005 error = vm_page_grab_valid_unlocked(&m, object, 0,
1006 VM_ALLOC_COUNT(VM_INITIAL_PAGEIN) |
1007 VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED);
1008
1009 if (error != VM_PAGER_OK)
1010 return (EIO);
1011 imgp->firstpage = sf_buf_alloc(m, 0);
1012 imgp->image_header = (char *)sf_buf_kva(imgp->firstpage);
1013
1014 return (0);
1015}
1016
1017void
1018exec_unmap_first_page(struct image_params *imgp)

Callers 2

do_execveFunction · 0.85
__elfN(load_file)Function · 0.85

Calls 5

exec_unmap_first_pageFunction · 0.85
vm_object_colorFunction · 0.85
sf_buf_allocFunction · 0.70
sf_buf_kvaFunction · 0.50

Tested by

no test coverage detected