Deleted Added
full compact
vm_map.c (7883) vm_map.c (8876)
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
64 * $Id: vm_map.c,v 1.20 1995/03/25 17:36:57 davidg Exp $
64 * $Id: vm_map.c,v 1.21 1995/04/16 12:56:17 davidg Exp $
65 */
66
67/*
68 * Virtual memory mapping module.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 70 unchanged lines hidden (view full) ---

143
144int kentry_count;
145static vm_offset_t mapvm_start, mapvm, mapvmmax;
146static int mapvmpgcnt;
147
148static void _vm_map_clip_end __P((vm_map_t, vm_map_entry_t, vm_offset_t));
149static void _vm_map_clip_start __P((vm_map_t, vm_map_entry_t, vm_offset_t));
150
65 */
66
67/*
68 * Virtual memory mapping module.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 70 unchanged lines hidden (view full) ---

143
144int kentry_count;
145static vm_offset_t mapvm_start, mapvm, mapvmmax;
146static int mapvmpgcnt;
147
148static void _vm_map_clip_end __P((vm_map_t, vm_map_entry_t, vm_offset_t));
149static void _vm_map_clip_start __P((vm_map_t, vm_map_entry_t, vm_offset_t));
150
151void
151void
152vm_map_startup()
153{
154 register int i;
155 register vm_map_entry_t mep;
156 vm_map_t mp;
157
158 /*
159 * Static map structures for allocation before initialization of

--- 80 unchanged lines hidden (view full) ---

240
241/*
242 * vm_map_create:
243 *
244 * Creates and returns a new empty VM map with
245 * the given physical map structure, and having
246 * the given lower and upper address bounds.
247 */
152vm_map_startup()
153{
154 register int i;
155 register vm_map_entry_t mep;
156 vm_map_t mp;
157
158 /*
159 * Static map structures for allocation before initialization of

--- 80 unchanged lines hidden (view full) ---

240
241/*
242 * vm_map_create:
243 *
244 * Creates and returns a new empty VM map with
245 * the given physical map structure, and having
246 * the given lower and upper address bounds.
247 */
248vm_map_t
248vm_map_t
249vm_map_create(pmap, min, max, pageable)
250 pmap_t pmap;
251 vm_offset_t min, max;
252 boolean_t pageable;
253{
254 register vm_map_t result;
255
256 if (kmem_map == NULL) {

--- 167 unchanged lines hidden (view full) ---

424 }
425
426/*
427 * vm_map_reference:
428 *
429 * Creates another valid reference to the given map.
430 *
431 */
249vm_map_create(pmap, min, max, pageable)
250 pmap_t pmap;
251 vm_offset_t min, max;
252 boolean_t pageable;
253{
254 register vm_map_t result;
255
256 if (kmem_map == NULL) {

--- 167 unchanged lines hidden (view full) ---

424 }
425
426/*
427 * vm_map_reference:
428 *
429 * Creates another valid reference to the given map.
430 *
431 */
432void
432void
433vm_map_reference(map)
434 register vm_map_t map;
435{
436 if (map == NULL)
437 return;
438
439 simple_lock(&map->ref_lock);
440 map->ref_count++;
441 simple_unlock(&map->ref_lock);
442}
443
444/*
445 * vm_map_deallocate:
446 *
447 * Removes a reference from the specified map,
448 * destroying it if no references remain.
449 * The map should not be locked.
450 */
433vm_map_reference(map)
434 register vm_map_t map;
435{
436 if (map == NULL)
437 return;
438
439 simple_lock(&map->ref_lock);
440 map->ref_count++;
441 simple_unlock(&map->ref_lock);
442}
443
444/*
445 * vm_map_deallocate:
446 *
447 * Removes a reference from the specified map,
448 * destroying it if no references remain.
449 * The map should not be locked.
450 */
451void
451void
452vm_map_deallocate(map)
453 register vm_map_t map;
454{
455 register int c;
456
457 if (map == NULL)
458 return;
459

--- 161 unchanged lines hidden (view full) ---

621 *
622 * Finds the map entry containing (or
623 * immediately preceding) the specified address
624 * in the given map; the entry is returned
625 * in the "entry" parameter. The boolean
626 * result indicates whether the address is
627 * actually contained in the map.
628 */
452vm_map_deallocate(map)
453 register vm_map_t map;
454{
455 register int c;
456
457 if (map == NULL)
458 return;
459

--- 161 unchanged lines hidden (view full) ---

621 *
622 * Finds the map entry containing (or
623 * immediately preceding) the specified address
624 * in the given map; the entry is returned
625 * in the "entry" parameter. The boolean
626 * result indicates whether the address is
627 * actually contained in the map.
628 */
629boolean_t
629boolean_t
630vm_map_lookup_entry(map, address, entry)
631 register vm_map_t map;
632 register vm_offset_t address;
633 vm_map_entry_t *entry; /* OUT */
634{
635 register vm_map_entry_t cur;
636 register vm_map_entry_t last;
637

--- 6 unchanged lines hidden (view full) ---

644 simple_unlock(&map->hint_lock);
645
646 if (cur == &map->header)
647 cur = cur->next;
648
649 if (address >= cur->start) {
650 /*
651 * Go from hint to end of list.
630vm_map_lookup_entry(map, address, entry)
631 register vm_map_t map;
632 register vm_offset_t address;
633 vm_map_entry_t *entry; /* OUT */
634{
635 register vm_map_entry_t cur;
636 register vm_map_entry_t last;
637

--- 6 unchanged lines hidden (view full) ---

644 simple_unlock(&map->hint_lock);
645
646 if (cur == &map->header)
647 cur = cur->next;
648
649 if (address >= cur->start) {
650 /*
651 * Go from hint to end of list.
652 *
652 *
653 * But first, make a quick check to see if we are already looking
654 * at the entry we want (which is usually the case). Note also
655 * that we don't need to save the hint here... it is the same
656 * hint (unless we are at the header, in which case the hint
657 * didn't buy us anything anyway).
658 */
659 last = &map->header;
660 if ((cur != last) && (cur->end > address)) {

--- 138 unchanged lines hidden (view full) ---

799
800/*
801 * vm_map_simplify_entry: [ internal use only ]
802 *
803 * Simplify the given map entry by:
804 * removing extra sharing maps
805 * [XXX maybe later] merging with a neighbor
806 */
653 * But first, make a quick check to see if we are already looking
654 * at the entry we want (which is usually the case). Note also
655 * that we don't need to save the hint here... it is the same
656 * hint (unless we are at the header, in which case the hint
657 * didn't buy us anything anyway).
658 */
659 last = &map->header;
660 if ((cur != last) && (cur->end > address)) {

--- 138 unchanged lines hidden (view full) ---

799
800/*
801 * vm_map_simplify_entry: [ internal use only ]
802 *
803 * Simplify the given map entry by:
804 * removing extra sharing maps
805 * [XXX maybe later] merging with a neighbor
806 */
807void
807void
808vm_map_simplify_entry(map, entry)
809 vm_map_t map;
810 vm_map_entry_t entry;
811{
812#ifdef lint
813 map++;
814#endif
815

--- 22 unchanged lines hidden (view full) ---

838 * (+ entry->offset) in my_share_map into place of
839 * entry. Later.
840 */
841 }
842#endif
843 } else {
844 /*
845 * Try to merge with our neighbors.
808vm_map_simplify_entry(map, entry)
809 vm_map_t map;
810 vm_map_entry_t entry;
811{
812#ifdef lint
813 map++;
814#endif
815

--- 22 unchanged lines hidden (view full) ---

838 * (+ entry->offset) in my_share_map into place of
839 * entry. Later.
840 */
841 }
842#endif
843 } else {
844 /*
845 * Try to merge with our neighbors.
846 *
846 *
847 * Conditions for merge are:
847 * Conditions for merge are:
848 *
848 *
849 * 1. entries are adjacent. 2. both entries point to objects
850 * with null pagers.
849 * 1. entries are adjacent. 2. both entries point to objects
850 * with null pagers.
851 *
851 *
852 * If a merge is possible, we replace the two entries with a
853 * single entry, then merge the two objects into a single
854 * object.
852 * If a merge is possible, we replace the two entries with a
853 * single entry, then merge the two objects into a single
854 * object.
855 *
855 *
856 * Now, all that is left to do is write the code!
857 */
858 }
859}
860
861/*
862 * vm_map_clip_start: [ internal use only ]
863 *

--- 6 unchanged lines hidden (view full) ---

870 if (startaddr > entry->start) \
871 _vm_map_clip_start(map, entry, startaddr); \
872}
873
874/*
875 * This routine is called only when it is known that
876 * the entry must be split.
877 */
856 * Now, all that is left to do is write the code!
857 */
858 }
859}
860
861/*
862 * vm_map_clip_start: [ internal use only ]
863 *

--- 6 unchanged lines hidden (view full) ---

870 if (startaddr > entry->start) \
871 _vm_map_clip_start(map, entry, startaddr); \
872}
873
874/*
875 * This routine is called only when it is known that
876 * the entry must be split.
877 */
878static void
878static void
879_vm_map_clip_start(map, entry, start)
880 register vm_map_t map;
881 register vm_map_entry_t entry;
882 register vm_offset_t start;
883{
884 register vm_map_entry_t new_entry;
885
886 /*

--- 36 unchanged lines hidden (view full) ---

923 if (endaddr < entry->end) \
924 _vm_map_clip_end(map, entry, endaddr); \
925}
926
927/*
928 * This routine is called only when it is known that
929 * the entry must be split.
930 */
879_vm_map_clip_start(map, entry, start)
880 register vm_map_t map;
881 register vm_map_entry_t entry;
882 register vm_offset_t start;
883{
884 register vm_map_entry_t new_entry;
885
886 /*

--- 36 unchanged lines hidden (view full) ---

923 if (endaddr < entry->end) \
924 _vm_map_clip_end(map, entry, endaddr); \
925}
926
927/*
928 * This routine is called only when it is known that
929 * the entry must be split.
930 */
931static void
931static void
932_vm_map_clip_end(map, entry, end)
933 register vm_map_t map;
934 register vm_map_entry_t entry;
935 register vm_offset_t end;
936{
937 register vm_map_entry_t new_entry;
938
939 /*

--- 334 unchanged lines hidden (view full) ---

1274 vm_fault_unwire(map, entry->start, entry->end);
1275
1276 entry = entry->next;
1277 }
1278 lock_clear_recursive(&map->lock);
1279 } else {
1280 /*
1281 * Wiring. We must do this in two passes:
932_vm_map_clip_end(map, entry, end)
933 register vm_map_t map;
934 register vm_map_entry_t entry;
935 register vm_offset_t end;
936{
937 register vm_map_entry_t new_entry;
938
939 /*

--- 334 unchanged lines hidden (view full) ---

1274 vm_fault_unwire(map, entry->start, entry->end);
1275
1276 entry = entry->next;
1277 }
1278 lock_clear_recursive(&map->lock);
1279 } else {
1280 /*
1281 * Wiring. We must do this in two passes:
1282 *
1282 *
1283 * 1. Holding the write lock, we create any shadow or zero-fill
1284 * objects that need to be created. Then we clip each map
1285 * entry to the region to be wired and increment its wiring
1286 * count. We create objects before clipping the map entries
1287 * to avoid object proliferation.
1283 * 1. Holding the write lock, we create any shadow or zero-fill
1284 * objects that need to be created. Then we clip each map
1285 * entry to the region to be wired and increment its wiring
1286 * count. We create objects before clipping the map entries
1287 * to avoid object proliferation.
1288 *
1288 *
1289 * 2. We downgrade to a read lock, and call vm_fault_wire to
1290 * fault in the pages for any newly wired area (wired_count is
1291 * 1).
1289 * 2. We downgrade to a read lock, and call vm_fault_wire to
1290 * fault in the pages for any newly wired area (wired_count is
1291 * 1).
1292 *
1292 *
1293 * Downgrading to a read lock for vm_fault_wire avoids a possible
1294 * deadlock with another thread that may have faulted on one
1295 * of the pages to be wired (it would mark the page busy,
1296 * blocking us, then in turn block on the map lock that we
1297 * hold). Because of problems in the recursive lock package,
1298 * we cannot upgrade to a write lock in vm_map_lookup. Thus,
1299 * any actions that require the write lock must be done
1300 * beforehand. Because we keep the read lock on the map, the

--- 7 unchanged lines hidden (view full) ---

1308 while ((entry != &map->header) && (entry->start < end)) {
1309 if (entry->wired_count == 0) {
1310
1311 /*
1312 * Perform actions of vm_map_lookup that need
1313 * the write lock on the map: create a shadow
1314 * object for a copy-on-write region, or an
1315 * object for a zero-fill region.
1293 * Downgrading to a read lock for vm_fault_wire avoids a possible
1294 * deadlock with another thread that may have faulted on one
1295 * of the pages to be wired (it would mark the page busy,
1296 * blocking us, then in turn block on the map lock that we
1297 * hold). Because of problems in the recursive lock package,
1298 * we cannot upgrade to a write lock in vm_map_lookup. Thus,
1299 * any actions that require the write lock must be done
1300 * beforehand. Because we keep the read lock on the map, the

--- 7 unchanged lines hidden (view full) ---

1308 while ((entry != &map->header) && (entry->start < end)) {
1309 if (entry->wired_count == 0) {
1310
1311 /*
1312 * Perform actions of vm_map_lookup that need
1313 * the write lock on the map: create a shadow
1314 * object for a copy-on-write region, or an
1315 * object for a zero-fill region.
1316 *
1316 *
1317 * We don't have to do this for entries that
1318 * point to sharing maps, because we won't
1319 * hold the lock on the sharing map.
1320 */
1321 if (!entry->is_a_map && !entry->is_sub_map) {
1322 if (entry->needs_copy &&
1323 ((entry->protection & VM_PROT_WRITE) != 0)) {
1324

--- 36 unchanged lines hidden (view full) ---

1361 }
1362
1363 /*
1364 * Pass 2.
1365 */
1366
1367 /*
1368 * HACK HACK HACK HACK
1317 * We don't have to do this for entries that
1318 * point to sharing maps, because we won't
1319 * hold the lock on the sharing map.
1320 */
1321 if (!entry->is_a_map && !entry->is_sub_map) {
1322 if (entry->needs_copy &&
1323 ((entry->protection & VM_PROT_WRITE) != 0)) {
1324

--- 36 unchanged lines hidden (view full) ---

1361 }
1362
1363 /*
1364 * Pass 2.
1365 */
1366
1367 /*
1368 * HACK HACK HACK HACK
1369 *
1369 *
1370 * If we are wiring in the kernel map or a submap of it, unlock
1371 * the map to avoid deadlocks. We trust that the kernel
1372 * threads are well-behaved, and therefore will not do
1373 * anything destructive to this region of the map while we
1374 * have it unlocked. We cannot trust user threads to do the
1375 * same.
1370 * If we are wiring in the kernel map or a submap of it, unlock
1371 * the map to avoid deadlocks. We trust that the kernel
1372 * threads are well-behaved, and therefore will not do
1373 * anything destructive to this region of the map while we
1374 * have it unlocked. We cannot trust user threads to do the
1375 * same.
1376 *
1376 *
1377 * HACK HACK HACK HACK
1378 */
1379 if (vm_map_pmap(map) == kernel_pmap) {
1380 vm_map_unlock(map); /* trust me ... */
1381 } else {
1382 lock_set_recursive(&map->lock);
1383 lock_write_to_read(&map->lock);
1384 }
1385
1386 rv = 0;
1387 entry = start_entry;
1388 while (entry != &map->header && entry->start < end) {
1389 /*
1390 * If vm_fault_wire fails for any page we need to undo
1391 * what has been done. We decrement the wiring count
1392 * for those pages which have not yet been wired (now)
1393 * and unwire those that have (later).
1377 * HACK HACK HACK HACK
1378 */
1379 if (vm_map_pmap(map) == kernel_pmap) {
1380 vm_map_unlock(map); /* trust me ... */
1381 } else {
1382 lock_set_recursive(&map->lock);
1383 lock_write_to_read(&map->lock);
1384 }
1385
1386 rv = 0;
1387 entry = start_entry;
1388 while (entry != &map->header && entry->start < end) {
1389 /*
1390 * If vm_fault_wire fails for any page we need to undo
1391 * what has been done. We decrement the wiring count
1392 * for those pages which have not yet been wired (now)
1393 * and unwire those that have (later).
1394 *
1394 *
1395 * XXX this violates the locking protocol on the map,
1396 * needs to be fixed.
1397 */
1398 if (rv)
1399 entry->wired_count--;
1400 else if (entry->wired_count == 1) {
1401 rv = vm_fault_wire(map, entry->start, entry->end);
1402 if (rv) {

--- 117 unchanged lines hidden (view full) ---

1520/*
1521 * vm_map_entry_unwire: [ internal use only ]
1522 *
1523 * Make the region specified by this entry pageable.
1524 *
1525 * The map in question should be locked.
1526 * [This is the reason for this routine's existence.]
1527 */
1395 * XXX this violates the locking protocol on the map,
1396 * needs to be fixed.
1397 */
1398 if (rv)
1399 entry->wired_count--;
1400 else if (entry->wired_count == 1) {
1401 rv = vm_fault_wire(map, entry->start, entry->end);
1402 if (rv) {

--- 117 unchanged lines hidden (view full) ---

1520/*
1521 * vm_map_entry_unwire: [ internal use only ]
1522 *
1523 * Make the region specified by this entry pageable.
1524 *
1525 * The map in question should be locked.
1526 * [This is the reason for this routine's existence.]
1527 */
1528void
1528void
1529vm_map_entry_unwire(map, entry)
1530 vm_map_t map;
1531 register vm_map_entry_t entry;
1532{
1533 vm_fault_unwire(map, entry->start, entry->end);
1534 entry->wired_count = 0;
1535}
1536
1537/*
1538 * vm_map_entry_delete: [ internal use only ]
1539 *
1540 * Deallocate the given entry from the target map.
1541 */
1529vm_map_entry_unwire(map, entry)
1530 vm_map_t map;
1531 register vm_map_entry_t entry;
1532{
1533 vm_fault_unwire(map, entry->start, entry->end);
1534 entry->wired_count = 0;
1535}
1536
1537/*
1538 * vm_map_entry_delete: [ internal use only ]
1539 *
1540 * Deallocate the given entry from the target map.
1541 */
1542void
1542void
1543vm_map_entry_delete(map, entry)
1544 register vm_map_t map;
1545 register vm_map_entry_t entry;
1546{
1547 if (entry->wired_count != 0)
1548 vm_map_entry_unwire(map, entry);
1549
1550 vm_map_entry_unlink(map, entry);

--- 133 unchanged lines hidden (view full) ---

1684
1685/*
1686 * vm_map_check_protection:
1687 *
1688 * Assert that the target map allows the specified
1689 * privilege on the entire address region given.
1690 * The entire region must be allocated.
1691 */
1543vm_map_entry_delete(map, entry)
1544 register vm_map_t map;
1545 register vm_map_entry_t entry;
1546{
1547 if (entry->wired_count != 0)
1548 vm_map_entry_unwire(map, entry);
1549
1550 vm_map_entry_unlink(map, entry);

--- 133 unchanged lines hidden (view full) ---

1684
1685/*
1686 * vm_map_check_protection:
1687 *
1688 * Assert that the target map allows the specified
1689 * privilege on the entire address region given.
1690 * The entire region must be allocated.
1691 */
1692boolean_t
1692boolean_t
1693vm_map_check_protection(map, start, end, protection)
1694 register vm_map_t map;
1695 register vm_offset_t start;
1696 register vm_offset_t end;
1697 register vm_prot_t protection;
1698{
1699 register vm_map_entry_t entry;
1700 vm_map_entry_t tmp_entry;

--- 30 unchanged lines hidden (view full) ---

1731}
1732
1733/*
1734 * vm_map_copy_entry:
1735 *
1736 * Copies the contents of the source entry to the destination
1737 * entry. The entries *must* be aligned properly.
1738 */
1693vm_map_check_protection(map, start, end, protection)
1694 register vm_map_t map;
1695 register vm_offset_t start;
1696 register vm_offset_t end;
1697 register vm_prot_t protection;
1698{
1699 register vm_map_entry_t entry;
1700 vm_map_entry_t tmp_entry;

--- 30 unchanged lines hidden (view full) ---

1731}
1732
1733/*
1734 * vm_map_copy_entry:
1735 *
1736 * Copies the contents of the source entry to the destination
1737 * entry. The entries *must* be aligned properly.
1738 */
1739void
1739void
1740vm_map_copy_entry(src_map, dst_map, src_entry, dst_entry)
1741 vm_map_t src_map, dst_map;
1742 register vm_map_entry_t src_entry, dst_entry;
1743{
1744 vm_object_t temp_object;
1745
1746 if (src_entry->is_sub_map || dst_entry->is_sub_map)
1747 return;

--- 205 unchanged lines hidden (view full) ---

1953 } else if (!vm_map_check_protection(dst_map, dst_start, dst_end,
1954 VM_PROT_WRITE)) {
1955 result = KERN_PROTECTION_FAILURE;
1956 goto Return;
1957 }
1958 }
1959 /*
1960 * Find the start entries and clip.
1740vm_map_copy_entry(src_map, dst_map, src_entry, dst_entry)
1741 vm_map_t src_map, dst_map;
1742 register vm_map_entry_t src_entry, dst_entry;
1743{
1744 vm_object_t temp_object;
1745
1746 if (src_entry->is_sub_map || dst_entry->is_sub_map)
1747 return;

--- 205 unchanged lines hidden (view full) ---

1953 } else if (!vm_map_check_protection(dst_map, dst_start, dst_end,
1954 VM_PROT_WRITE)) {
1955 result = KERN_PROTECTION_FAILURE;
1956 goto Return;
1957 }
1958 }
1959 /*
1960 * Find the start entries and clip.
1961 *
1961 *
1962 * Note that checking protection asserts that the lookup cannot fail.
1962 * Note that checking protection asserts that the lookup cannot fail.
1963 *
1963 *
1964 * Also note that we wait to do the second lookup until we have done the
1965 * first clip, as the clip may affect which entry we get!
1966 */
1967
1968 (void) vm_map_lookup_entry(src_map, src_addr, &tmp_entry);
1969 src_entry = tmp_entry;
1970 vm_map_clip_start(src_map, src_entry, src_start);
1971

--- 37 unchanged lines hidden (view full) ---

2009 src_clip = src_entry->start + (dst_entry->end - dst_entry->start);
2010 vm_map_clip_end(src_map, src_entry, src_clip);
2011
2012 dst_clip = dst_entry->start + (src_entry->end - src_entry->start);
2013 vm_map_clip_end(dst_map, dst_entry, dst_clip);
2014
2015 /*
2016 * Both entries now match in size and relative endpoints.
1964 * Also note that we wait to do the second lookup until we have done the
1965 * first clip, as the clip may affect which entry we get!
1966 */
1967
1968 (void) vm_map_lookup_entry(src_map, src_addr, &tmp_entry);
1969 src_entry = tmp_entry;
1970 vm_map_clip_start(src_map, src_entry, src_start);
1971

--- 37 unchanged lines hidden (view full) ---

2009 src_clip = src_entry->start + (dst_entry->end - dst_entry->start);
2010 vm_map_clip_end(src_map, src_entry, src_clip);
2011
2012 dst_clip = dst_entry->start + (src_entry->end - src_entry->start);
2013 vm_map_clip_end(dst_map, dst_entry, dst_clip);
2014
2015 /*
2016 * Both entries now match in size and relative endpoints.
2017 *
2017 *
2018 * If both entries refer to a VM object, we can deal with them
2019 * now.
2020 */
2021
2022 if (!src_entry->is_a_map && !dst_entry->is_a_map) {
2023 vm_map_copy_entry(src_map, dst_map, src_entry,
2024 dst_entry);
2025 } else {

--- 407 unchanged lines hidden (view full) ---

2433 /*
2434 * If the entry was copy-on-write, we either ...
2435 */
2436
2437 if (entry->needs_copy) {
2438 /*
2439 * If we want to write the page, we may as well handle that
2440 * now since we've got the sharing map locked.
2018 * If both entries refer to a VM object, we can deal with them
2019 * now.
2020 */
2021
2022 if (!src_entry->is_a_map && !dst_entry->is_a_map) {
2023 vm_map_copy_entry(src_map, dst_map, src_entry,
2024 dst_entry);
2025 } else {

--- 407 unchanged lines hidden (view full) ---

2433 /*
2434 * If the entry was copy-on-write, we either ...
2435 */
2436
2437 if (entry->needs_copy) {
2438 /*
2439 * If we want to write the page, we may as well handle that
2440 * now since we've got the sharing map locked.
2441 *
2441 *
2442 * If we don't need to write the page, we just demote the
2443 * permissions allowed.
2444 */
2445
2446 if (fault_type & VM_PROT_WRITE) {
2447 /*
2448 * Make a new object, and place it in the object
2449 * chain. Note that no new references have appeared

--- 65 unchanged lines hidden (view full) ---

2515
2516/*
2517 * vm_map_lookup_done:
2518 *
2519 * Releases locks acquired by a vm_map_lookup
2520 * (according to the handle returned by that lookup).
2521 */
2522
2442 * If we don't need to write the page, we just demote the
2443 * permissions allowed.
2444 */
2445
2446 if (fault_type & VM_PROT_WRITE) {
2447 /*
2448 * Make a new object, and place it in the object
2449 * chain. Note that no new references have appeared

--- 65 unchanged lines hidden (view full) ---

2515
2516/*
2517 * vm_map_lookup_done:
2518 *
2519 * Releases locks acquired by a vm_map_lookup
2520 * (according to the handle returned by that lookup).
2521 */
2522
2523void
2523void
2524vm_map_lookup_done(map, entry)
2525 register vm_map_t map;
2526 vm_map_entry_t entry;
2527{
2528 /*
2529 * If this entry references a map, unlock it first.
2530 */
2531

--- 14 unchanged lines hidden (view full) ---

2546 * the vicinity of the given starting address.
2547 * Note:
2548 * This routine is intended primarily to keep the
2549 * kernel maps more compact -- they generally don't
2550 * benefit from the "expand a map entry" technology
2551 * at allocation time because the adjacent entry
2552 * is often wired down.
2553 */
2524vm_map_lookup_done(map, entry)
2525 register vm_map_t map;
2526 vm_map_entry_t entry;
2527{
2528 /*
2529 * If this entry references a map, unlock it first.
2530 */
2531

--- 14 unchanged lines hidden (view full) ---

2546 * the vicinity of the given starting address.
2547 * Note:
2548 * This routine is intended primarily to keep the
2549 * kernel maps more compact -- they generally don't
2550 * benefit from the "expand a map entry" technology
2551 * at allocation time because the adjacent entry
2552 * is often wired down.
2553 */
2554void
2554void
2555vm_map_simplify(map, start)
2556 vm_map_t map;
2557 vm_offset_t start;
2558{
2559 vm_map_entry_t this_entry;
2560 vm_map_entry_t prev_entry;
2561
2562 vm_map_lock(map);

--- 35 unchanged lines hidden (view full) ---

2598 }
2599 vm_map_unlock(map);
2600}
2601
2602#ifdef DDB
2603/*
2604 * vm_map_print: [ debug ]
2605 */
2555vm_map_simplify(map, start)
2556 vm_map_t map;
2557 vm_offset_t start;
2558{
2559 vm_map_entry_t this_entry;
2560 vm_map_entry_t prev_entry;
2561
2562 vm_map_lock(map);

--- 35 unchanged lines hidden (view full) ---

2598 }
2599 vm_map_unlock(map);
2600}
2601
2602#ifdef DDB
2603/*
2604 * vm_map_print: [ debug ]
2605 */
2606void
2606void
2607vm_map_print(map, full)
2608 register vm_map_t map;
2609 boolean_t full;
2610{
2611 register vm_map_entry_t entry;
2612
2613 iprintf("%s map 0x%x: pmap=0x%x,ref=%d,nentries=%d,version=%d\n",
2614 (map->is_main_map ? "Task" : "Share"),

--- 56 unchanged lines hidden ---
2607vm_map_print(map, full)
2608 register vm_map_t map;
2609 boolean_t full;
2610{
2611 register vm_map_entry_t entry;
2612
2613 iprintf("%s map 0x%x: pmap=0x%x,ref=%d,nentries=%d,version=%d\n",
2614 (map->is_main_map ? "Task" : "Share"),

--- 56 unchanged lines hidden ---