diff options
Diffstat (limited to 'vm')
-rw-r--r-- | vm/memory_object.c | 36 | ||||
-rw-r--r-- | vm/pmap.h | 22 | ||||
-rw-r--r-- | vm/vm_init.c | 1 | ||||
-rw-r--r-- | vm/vm_kern.c | 1 | ||||
-rw-r--r-- | vm/vm_kern.h | 5 | ||||
-rw-r--r-- | vm/vm_map.c | 15 | ||||
-rw-r--r-- | vm/vm_map.h | 54 | ||||
-rw-r--r-- | vm/vm_pageout.c | 3 | ||||
-rw-r--r-- | vm/vm_resident.h | 45 | ||||
-rw-r--r-- | vm/vm_user.c | 1 |
10 files changed, 166 insertions, 17 deletions
diff --git a/vm/memory_object.c b/vm/memory_object.c index 6bef2c9..57dde76 100644 --- a/vm/memory_object.c +++ b/vm/memory_object.c @@ -41,6 +41,7 @@ #include <mach/mach_types.h> #include <mach/kern_return.h> +#include <vm/vm_map.h> #include <vm/vm_object.h> #include <mach/memory_object.h> #include <mach/boolean.h> @@ -81,23 +82,6 @@ decl_simple_lock_data(,memory_manager_default_lock) * argument conversion. Explicit deallocation is necessary. */ -/* - * If successful, destroys the map copy object. - */ -kern_return_t memory_object_data_provided(object, offset, data, data_cnt, - lock_value) - vm_object_t object; - vm_offset_t offset; - pointer_t data; - unsigned int data_cnt; - vm_prot_t lock_value; -{ - return memory_object_data_supply(object, offset, (vm_map_copy_t) data, - data_cnt, lock_value, FALSE, IP_NULL, - 0); -} - - kern_return_t memory_object_data_supply(object, offset, data_copy, data_cnt, lock_value, precious, reply_to, reply_to_type) register @@ -323,6 +307,24 @@ retry_lookup: return(result); } + +/* + * If successful, destroys the map copy object. + */ +kern_return_t memory_object_data_provided(object, offset, data, data_cnt, + lock_value) + vm_object_t object; + vm_offset_t offset; + pointer_t data; + unsigned int data_cnt; + vm_prot_t lock_value; +{ + return memory_object_data_supply(object, offset, (vm_map_copy_t) data, + data_cnt, lock_value, FALSE, IP_NULL, + 0); +} + + kern_return_t memory_object_data_error(object, offset, size, error_value) vm_object_t object; vm_offset_t offset; @@ -218,6 +218,28 @@ extern vm_offset_t pmap_grab_page (void); extern boolean_t pmap_valid_page(vm_offset_t x); /* + * Make the specified pages (by pmap, offset) + * pageable (or not) as requested. + */ +extern void pmap_pageable( + pmap_t pmap, + vm_offset_t start, + vm_offset_t end, + boolean_t pageable); + +/* + * Back-door routine for mapping kernel VM at initialization. + * Useful for mapping memory outside the range + * [phys_first_addr, phys_last_addr) (i.e., devices). + * Otherwise like pmap_map. + */ +extern vm_offset_t pmap_map_bd( + vm_offset_t virt, + vm_offset_t start, + vm_offset_t end, + vm_prot_t prot); + +/* * Routines defined as macros. */ #ifndef PMAP_ACTIVATE_USER diff --git a/vm/vm_init.c b/vm/vm_init.c index b76b11b..06317ac 100644 --- a/vm/vm_init.c +++ b/vm/vm_init.c @@ -37,6 +37,7 @@ #include <mach/machine/vm_types.h> #include <kern/zalloc.h> #include <kern/kalloc.h> +#include <vm/vm_fault.h> #include <vm/vm_object.h> #include <vm/vm_map.h> #include <vm/vm_page.h> diff --git a/vm/vm_kern.c b/vm/vm_kern.c index bb6c110..f29a014 100644 --- a/vm/vm_kern.c +++ b/vm/vm_kern.c @@ -43,6 +43,7 @@ #include <kern/debug.h> #include <kern/lock.h> #include <kern/thread.h> +#include <vm/pmap.h> #include <vm/vm_fault.h> #include <vm/vm_kern.h> #include <vm/vm_map.h> diff --git a/vm/vm_kern.h b/vm/vm_kern.h index 228c26d..ca93d7a 100644 --- a/vm/vm_kern.h +++ b/vm/vm_kern.h @@ -77,4 +77,9 @@ extern vm_map_t kernel_map; extern vm_map_t kernel_pageable_map; extern vm_map_t ipc_kernel_map; +extern boolean_t projected_buffer_in_range( + vm_map_t map, + vm_offset_t start, + vm_offset_t end); + #endif /* _VM_VM_KERN_H_ */ diff --git a/vm/vm_map.c b/vm/vm_map.c index 43afe91..260eb5a 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -42,13 +42,28 @@ #include <kern/assert.h> #include <kern/debug.h> #include <kern/zalloc.h> +#include <vm/pmap.h> #include <vm/vm_fault.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> +#include <vm/vm_resident.h> #include <vm/vm_kern.h> #include <ipc/ipc_port.h> +/* Forward declarations */ +kern_return_t vm_map_delete( + vm_map_t map, + vm_offset_t start, + vm_offset_t end); + +kern_return_t vm_map_copyout_page_list( + vm_map_t dst_map, + vm_offset_t *dst_addr, /* OUT */ + vm_map_copy_t copy); + +void vm_map_copy_page_discard (vm_map_copy_t copy); + /* * Macros to copy a vm_map_entry. We must be careful to correctly * manage the wired page count. vm_map_entry_copy() creates a new diff --git a/vm/vm_map.h b/vm/vm_map.h index 40c828a..8961e1b 100644 --- a/vm/vm_map.h +++ b/vm/vm_map.h @@ -466,6 +466,42 @@ extern kern_return_t vm_map_pageable_common(vm_map_t, vm_offset_t, extern vm_object_t vm_submap_object; /* + * vm_map_copyin_object: + * + * Create a copy object from an object. + * Our caller donates an object reference. + */ +extern kern_return_t vm_map_copyin_object( + vm_object_t object, + vm_offset_t offset, /* offset of region in object */ + vm_size_t size, /* size of region in object */ + vm_map_copy_t *copy_result); /* OUT */ + +/* + * vm_map_submap: [ kernel use only ] + * + * Mark the given range as handled by a subordinate map. + * + * This range must have been created with vm_map_find using + * the vm_submap_object, and no other operations may have been + * performed on this range prior to calling vm_map_submap. + * + * Only a limited number of operations can be performed + * within this rage after calling vm_map_submap: + * vm_fault + * [Don't try vm_map_copyin!] + * + * To remove a submapping, one must first remove the + * range from the superior map, and then destroy the + * submap (if desired). [Better yet, don't try it.] + */ +extern kern_return_t vm_map_submap( + vm_map_t map, + vm_offset_t start, + vm_offset_t end, + vm_map_t submap); + +/* * Wait and wakeup macros for in_transition map entries. */ #define vm_map_entry_wait(map, interruptible) \ @@ -477,4 +513,22 @@ extern vm_object_t vm_submap_object; #define vm_map_entry_wakeup(map) thread_wakeup((event_t)&(map)->hdr) +/* + * This routine is called only when it is known that + * the entry must be split. + */ +extern void _vm_map_clip_start( + struct vm_map_header *map_header, + vm_map_entry_t entry, + vm_offset_t start); + +/* + * vm_map_clip_end: [ internal use only ] + * + * Asserts that the given entry ends at or before + * the specified address; if necessary, + * it splits the entry into two. + */ +void _vm_map_clip_end(); + #endif /* _VM_VM_MAP_H_ */ diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c index 6db1cb7..ba3b9ba 100644 --- a/vm/vm_pageout.c +++ b/vm/vm_pageout.c @@ -34,6 +34,7 @@ * The proverbial page-out daemon. */ +#include <device/net_io.h> #include <mach/mach_types.h> #include <mach/memory_object.h> #include <vm/memory_object_default.user.h> @@ -42,12 +43,14 @@ #include <mach/vm_statistics.h> #include <kern/counters.h> #include <kern/debug.h> +#include <kern/task.h> #include <kern/thread.h> #include <vm/pmap.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pageout.h> +#include <machine/locore.h> #include <machine/vm_tuning.h> diff --git a/vm/vm_resident.h b/vm/vm_resident.h new file mode 100644 index 0000000..67f1807 --- /dev/null +++ b/vm/vm_resident.h @@ -0,0 +1,45 @@ +/* + * Resident memory management module functions. + * Copyright (C) 2008 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * Resident memory management module functions. + * + */ + +#ifndef _VM_RESIDENT_H_ +#define _VM_RESIDENT_H_ + +#include <mach/std_types.h> + +/* + * vm_page_replace: + * + * Exactly like vm_page_insert, except that we first + * remove any existing page at the given offset in object + * and we don't do deactivate-behind. + * + * The object and page must be locked. + */ +extern void vm_page_replace ( + register vm_page_t mem, + register vm_object_t object, + register vm_offset_t offset); + +#endif /* _VM_RESIDENT_H_ */ diff --git a/vm/vm_user.c b/vm/vm_user.c index ebe9844..813b100 100644 --- a/vm/vm_user.c +++ b/vm/vm_user.c @@ -41,6 +41,7 @@ #include <kern/host.h> #include <kern/task.h> #include <vm/vm_fault.h> +#include <vm/vm_kern.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> |