summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-07-20 17:05:43 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:27:17 +0200
commit1fac2f5107e94102ca643ab9b031030bbcb1daa1 (patch)
tree4aac49598b75ace461ab2ce69aa765a5f6037222 /vm
parent311826c0b9e06edd1cc5cb7fc82a6c16614b28ce (diff)
2008-07-20 Samuel Thibault <samuel.thibault@ens-lyon.org>
* linux/pcmcia-cs/glue/wireless_glue.h (schedule_task): Add parameter to Debugger() call. * kern/lock_mon.c (retry_simple_lock, retry_bit_lock): Likewise. * kern/machine.c (Debugger): Remove declaration. 2008-07-19 Barry deFreese <bddebian@comcast.net> * device/dev_hdr.h (dev_name_lookup, dev_set_indirection): Add prototypes. * device/dev_pager.c: Include <vm/vm_user.h>. * device/ds_routines.c: Likewise. * device/subrs.c: Likewise. * device/device_init.c: Include <device/tty.h>. * device/ds_routines.h (iowait): Add prototype. * device/net_io.h (net_kmsg_collect): Add prototype. * device/net_io.c (hash_ent_remove, net_free_dead_infp, net_free_dead_entp, bpf_validate, bpf_eq, net_add_q_info, bpf_match): Add forward declarations. * device/subrs.h: New header. * i386/i386/fpu.h: Include <sys/types.h>. Change <i386/thread.h> include to <kern/thread.h>. (fp_save, fp_load, fp_free, fpu_module_init, fpu_set_state, fpu_get_state, fpnoextflt, fpextovrflt, fpexterrflt, init_fpu): Add prototypes. * i386/i386/gdt.h (gdt_init): Add prototype. * i386/i386/io_map.c: Include <vm/pmap.h>. * vm/vm_kern.c: Likewise. * i386/i386/ktss.h (ktss_init): Add prototype. * i386/i386/ldt.h (ldt_init): Add prototype. * i386/i386/loose_ends.h: New header. * i386/i386/loose_ends.c (delay): Complete prototype. * i386/i386/model_dep.h (startrtclock): Add prototype. * i386/i386/pcb.h (load_context, stack_attach, stack_detach, switch_ktss): Add prototypes. * i386/i386/pic.h (form_pic_mask, picinit): Add prototypes. * i386/i386/pit.c: Include <i386/pic.h>. * i386/i386at/kd_mouse.c: Likewise. * i386/i386/pit.h (clkstart): Add prototype. * i386/i386/trap.c: Include <i386/fpu.h>, <intel/read_fault.h>, <vm/vm_fault.h>. * i386/i386/trap.h (interrupted_pc): Add prototype. * i386/i386/user_ldt.c: Include <i386/pcb.h>. * i386/i386at/autoconf.h: New header. * i386/i386at/com.h: New header. * i386/i386at/com.c: Include <i386at/autoconf.h>, <i386at/com.h>. * i386/i386at/idt.h (idt_init): Add prototype. * i386/i386at/int_init.h: New header. * i386/i386at/kd.c: Include <i386/loose_ends.h>. * kern/debug.c: Likewise. * i386/i386at/kd_event.c: Include <device/ds_routines.h>. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/kd_mouse.c: Include <device/subrs.h>, <i386at/com.h>. * i386/i386at/lpr.c: Include <i386at/autoconf.h> * i386/i386at/model_dep.c: Include: <i386/fpu.h>, <i386/gdt.h>, <i386/ktss.h>, <i386/ldt.h>, <i386/pic.h>, <i386/pit.h>, <i386at/autoconf.h>, <i386at/idt.h>, <i386at/int_init.h>, <i386at/kd.h>, <i386at/rtc.h>. * i386/i386at/rtc.h (readtodc, writetodc): Add prototypes. * i386/intel/pmap.h: Include <mach/vm_prot.h>. (pmap_bootstrap, pmap_unmap_page_zero, pmap_zero_page, pmap_copy_page, kvtophys): Add prototypes. * i386/intel/read_fault.h: New header. * kern/ast.h (ast_init, ast_check): Add prototypes. * kern/debug.c (Debugger): Move prototype to... * kern/debug.h (Debugger): ... here. * kern/eventcount.h (evc_notify_abort): Add prototype. * kern/ipc_mig.c: Include <kern/syscall_subr.h>, <kern/ipc_tt.h>, <device/ds_routines.h> * kern/ipc_mig.h: New header. * kern/ipc_tt.h (mach_reply_port): Add prototype. * kern/machine.h: New header. * kern/processor.h (pset_sys_bootstrap): Move prototype outside of MACH_HOST check. * kern/sched_prim.h (thread_bind, compute_priority, thread_timeout_setup): Add prototypes. * kern/startup.c: Include <kern/machine.h>, <machine/pcb.h>. * kern/syscall_subr.c: Include <kern/syscall_subr.h>. (thread_depress_abort): Remove prototype. * kern/syscall_subr.h: Include <sys/types.h>, <mach/mach_types.h> (thread_depress_abort): Add prototype. * kern/syscall_sw.c: Include: <kern/debug.h>. * kern/task.h (consider_task_collect): Add prototype. * kern/thread.c: Include <kern/eventcount.h>, <kern/ipc_mig.h>, <kern/syscall_subr.h>. * kern/thread.h (stack_collect): Add prototype. * linux/pcmcia-cs/glue/pcmcia_glue.h (Debugger): Remove prototype. * util/putchar.c: Include <device/cons.h>. * util/putchar.h: New header. * util/puts.c: Include <device/cons.h>, <util/putchar.h>. * vm/memory_object.c: Include <vm/vm_map.h>. (memory_object_data_provided): Move function below memory_object_data_supply definition. * vm/vm_init.c: Include <vm/vm_fault.h>. * vm/vm_kern.h (projected_buffer_in_range): Add prototype. * vm/vm_map.c: Include <vm/pmap.h>, <vm/vm_resident.h>. (vm_map_delete, vm_map_copyout_page_list, vm_map_copy_page_discard): Add forward declaration. * vm/vm_map.h (vm_map_copyin_object, vm_map_submap, _vm_map_clip_start, _vm_map_clip_end): Add prototypes. * vm/vm_pageout.c: Include <device/net_io.h>, <kern/task.h>, <machine/locore.h>. * vm/vm_resident.h: New header. * vm/vm_user.c: Include <vm/vm_kern.h>. * vm/pmap.h (pmap_pageable, pmap_map_bd): Add prototype.
Diffstat (limited to 'vm')
-rw-r--r--vm/memory_object.c36
-rw-r--r--vm/pmap.h22
-rw-r--r--vm/vm_init.c1
-rw-r--r--vm/vm_kern.c1
-rw-r--r--vm/vm_kern.h5
-rw-r--r--vm/vm_map.c15
-rw-r--r--vm/vm_map.h54
-rw-r--r--vm/vm_pageout.c3
-rw-r--r--vm/vm_resident.h45
-rw-r--r--vm/vm_user.c1
10 files changed, 166 insertions, 17 deletions
diff --git a/vm/memory_object.c b/vm/memory_object.c
index 6bef2c9a..57dde76b 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;
diff --git a/vm/pmap.h b/vm/pmap.h
index 66818a10..59fd03ab 100644
--- a/vm/pmap.h
+++ b/vm/pmap.h
@@ -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 b76b11b6..06317ace 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 bb6c110a..f29a0144 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 228c26d9..ca93d7a4 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 43afe919..260eb5a8 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 40c828a2..8961e1b9 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 6db1cb74..ba3b9ba5 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 00000000..67f1807f
--- /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 ebe98449..813b100c 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>