Tidy up the early parts of vm_map_insert(), in particular, simplify one
of the assertions and eliminate a comment that has grown stale. Reviewed by: kib MFC after: 1 week
This commit is contained in:
parent
0413bfcac9
commit
33314db034
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=267546
@ -1112,18 +1112,20 @@ vm_map_lookup_entry(
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
||||||
vm_offset_t start, vm_offset_t end, vm_prot_t prot, vm_prot_t max,
|
vm_offset_t start, vm_offset_t end, vm_prot_t prot, vm_prot_t max, int cow)
|
||||||
int cow)
|
|
||||||
{
|
{
|
||||||
vm_map_entry_t new_entry;
|
vm_map_entry_t new_entry, prev_entry, temp_entry;
|
||||||
vm_map_entry_t prev_entry;
|
|
||||||
vm_map_entry_t temp_entry;
|
|
||||||
vm_eflags_t protoeflags;
|
vm_eflags_t protoeflags;
|
||||||
struct ucred *cred;
|
struct ucred *cred;
|
||||||
vm_inherit_t inheritance;
|
vm_inherit_t inheritance;
|
||||||
boolean_t charge_prev_obj;
|
boolean_t charge_prev_obj;
|
||||||
|
|
||||||
VM_MAP_ASSERT_LOCKED(map);
|
VM_MAP_ASSERT_LOCKED(map);
|
||||||
|
KASSERT((object != kmem_object && object != kernel_object) ||
|
||||||
|
(cow & MAP_COPY_ON_WRITE) == 0,
|
||||||
|
("vm_map_insert: kmem or kernel object and COW"));
|
||||||
|
KASSERT(object == NULL || (cow & MAP_NOFAULT) == 0,
|
||||||
|
("vm_map_insert: paradoxical MAP_NOFAULT request"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that the start and end points are not bogus.
|
* Check that the start and end points are not bogus.
|
||||||
@ -1149,17 +1151,10 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
|||||||
return (KERN_NO_SPACE);
|
return (KERN_NO_SPACE);
|
||||||
|
|
||||||
protoeflags = 0;
|
protoeflags = 0;
|
||||||
charge_prev_obj = FALSE;
|
|
||||||
|
|
||||||
if (cow & MAP_COPY_ON_WRITE)
|
if (cow & MAP_COPY_ON_WRITE)
|
||||||
protoeflags |= MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY;
|
protoeflags |= MAP_ENTRY_COW | MAP_ENTRY_NEEDS_COPY;
|
||||||
|
if (cow & MAP_NOFAULT)
|
||||||
if (cow & MAP_NOFAULT) {
|
|
||||||
protoeflags |= MAP_ENTRY_NOFAULT;
|
protoeflags |= MAP_ENTRY_NOFAULT;
|
||||||
|
|
||||||
KASSERT(object == NULL,
|
|
||||||
("vm_map_insert: paradoxical MAP_NOFAULT request"));
|
|
||||||
}
|
|
||||||
if (cow & MAP_DISABLE_SYNCER)
|
if (cow & MAP_DISABLE_SYNCER)
|
||||||
protoeflags |= MAP_ENTRY_NOSYNC;
|
protoeflags |= MAP_ENTRY_NOSYNC;
|
||||||
if (cow & MAP_DISABLE_COREDUMP)
|
if (cow & MAP_DISABLE_COREDUMP)
|
||||||
@ -1172,10 +1167,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
|||||||
inheritance = VM_INHERIT_DEFAULT;
|
inheritance = VM_INHERIT_DEFAULT;
|
||||||
|
|
||||||
cred = NULL;
|
cred = NULL;
|
||||||
KASSERT((object != kmem_object && object != kernel_object) ||
|
charge_prev_obj = FALSE;
|
||||||
((object == kmem_object || object == kernel_object) &&
|
|
||||||
!(protoeflags & MAP_ENTRY_NEEDS_COPY)),
|
|
||||||
("kmem or kernel object and cow"));
|
|
||||||
if (cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT))
|
if (cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT))
|
||||||
goto charged;
|
goto charged;
|
||||||
if ((cow & MAP_ACC_CHARGED) || ((prot & VM_PROT_WRITE) &&
|
if ((cow & MAP_ACC_CHARGED) || ((prot & VM_PROT_WRITE) &&
|
||||||
@ -1255,12 +1247,6 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: if conditionals fail, object can be NULL here. This occurs
|
|
||||||
* in things like the buffer map where we manage kva but do not manage
|
|
||||||
* backing objects.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new entry
|
* Create a new entry
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user