mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
First phase of removing the PG_COPYONWRITE flag, and an architectural
cleanup of mapping files.
This commit is contained in:
parent
cd0402ec7a
commit
e17bed1226
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11705
@ -66,7 +66,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_fault.c,v 1.32 1995/09/24 19:47:58 dyson Exp $
|
||||
* $Id: vm_fault.c,v 1.33 1995/10/07 19:02:53 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -532,7 +532,6 @@ RetryFault:;
|
||||
object->paging_in_progress++;
|
||||
} else {
|
||||
prot &= ~VM_PROT_WRITE;
|
||||
m->flags |= PG_COPYONWRITE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -590,19 +589,12 @@ RetryFault:;
|
||||
* write-enabled after all.
|
||||
*/
|
||||
prot &= retry_prot;
|
||||
if (m->flags & PG_COPYONWRITE)
|
||||
prot &= ~VM_PROT_WRITE;
|
||||
}
|
||||
/*
|
||||
* (the various bits we're fiddling with here are locked by the
|
||||
* object's lock)
|
||||
*/
|
||||
|
||||
/* XXX This distorts the meaning of the copy_on_write bit */
|
||||
|
||||
if (prot & VM_PROT_WRITE)
|
||||
m->flags &= ~PG_COPYONWRITE;
|
||||
|
||||
/*
|
||||
* It's critically important that a wired-down page be faulted only
|
||||
* once in each map for which it is wired.
|
||||
|
@ -38,7 +38,7 @@
|
||||
* from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
|
||||
*
|
||||
* @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94
|
||||
* $Id: vm_mmap.c,v 1.26 1995/07/13 08:48:31 davidg Exp $
|
||||
* $Id: vm_mmap.c,v 1.27 1995/10/21 17:42:28 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -636,50 +636,31 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff)
|
||||
if (object == NULL)
|
||||
return (type == OBJT_DEVICE ? EINVAL : ENOMEM);
|
||||
|
||||
/*
|
||||
* Anonymous memory, shared file, or character special file.
|
||||
*/
|
||||
if ((flags & (MAP_ANON|MAP_SHARED)) || (type == OBJT_DEVICE)) {
|
||||
rv = vm_map_find(map, object, foff, addr, size, fitit);
|
||||
if (rv != KERN_SUCCESS) {
|
||||
/*
|
||||
* Lose the object reference. Will destroy the
|
||||
* object if it's an unnamed anonymous mapping
|
||||
* or named anonymous without other references.
|
||||
*/
|
||||
vm_object_deallocate(object);
|
||||
goto out;
|
||||
}
|
||||
rv = vm_map_find(map, object, foff, addr, size, fitit);
|
||||
if (rv != KERN_SUCCESS) {
|
||||
/*
|
||||
* Lose the object reference. Will destroy the
|
||||
* object if it's an unnamed anonymous mapping
|
||||
* or named anonymous without other references.
|
||||
*/
|
||||
vm_object_deallocate(object);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* mmap a COW regular file
|
||||
*/
|
||||
else {
|
||||
if ((flags & (MAP_ANON|MAP_SHARED)) == 0 && (type != OBJT_DEVICE)) {
|
||||
vm_map_entry_t entry;
|
||||
vm_object_t private_object;
|
||||
|
||||
/*
|
||||
* Create a new object and make the original object
|
||||
* the backing object. NOTE: the object reference gained
|
||||
* above is now changed into the reference held by
|
||||
* private_object. Since we don't map 'object', we want
|
||||
* only this one reference.
|
||||
*/
|
||||
private_object = vm_object_allocate(OBJT_DEFAULT, object->size);
|
||||
private_object->backing_object = object;
|
||||
TAILQ_INSERT_TAIL(&object->shadow_head,
|
||||
private_object, shadow_list);
|
||||
|
||||
rv = vm_map_find(map, private_object, foff, addr, size, fitit);
|
||||
if (rv != KERN_SUCCESS) {
|
||||
vm_object_deallocate(private_object);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!vm_map_lookup_entry(map, *addr, &entry)) {
|
||||
panic("vm_mmap: missing map entry!!!");
|
||||
}
|
||||
entry->copy_on_write = TRUE;
|
||||
/*
|
||||
* This will create the processes private object on
|
||||
* an as needed basis.
|
||||
*/
|
||||
entry->needs_copy = TRUE;
|
||||
|
||||
/*
|
||||
* set pages COW and protect for read access only
|
||||
|
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_object.c,v 1.52 1995/08/16 16:14:28 bde Exp $
|
||||
* $Id: vm_object.c,v 1.53 1995/08/26 23:19:48 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -615,7 +615,6 @@ vm_object_pmap_copy(object, start, end)
|
||||
for (p = object->memq.tqh_first; p != NULL; p = p->listq.tqe_next) {
|
||||
if ((start <= p->offset) && (p->offset < end)) {
|
||||
vm_page_protect(p, VM_PROT_READ);
|
||||
p->flags |= PG_COPYONWRITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -709,14 +708,6 @@ vm_object_copy(src_object, src_offset, size,
|
||||
*/
|
||||
src_object->ref_count++;
|
||||
|
||||
/*
|
||||
* Mark all of the pages copy-on-write.
|
||||
*/
|
||||
for (p = src_object->memq.tqh_first; p; p = p->listq.tqe_next)
|
||||
if (src_offset <= p->offset &&
|
||||
p->offset < src_offset + size)
|
||||
p->flags |= PG_COPYONWRITE;
|
||||
|
||||
*dst_object = src_object;
|
||||
*dst_offset = src_offset;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user