| 983 | } |
| 984 | |
| 985 | int |
| 986 | exec_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 | |
| 1017 | void |
| 1018 | exec_unmap_first_page(struct image_params *imgp) |
no test coverage detected