diff options
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm.h | 18 | ||||
-rw-r--r-- | sys/vm/vm_extern.h | 76 | ||||
-rw-r--r-- | sys/vm/vm_kern.h | 11 | ||||
-rw-r--r-- | sys/vm/vm_map.h | 144 | ||||
-rw-r--r-- | sys/vm/vm_object.h | 157 | ||||
-rw-r--r-- | sys/vm/vm_page.h | 185 | ||||
-rw-r--r-- | sys/vm/vm_pageout.h | 30 | ||||
-rw-r--r-- | sys/vm/vm_pager.h | 95 | ||||
-rw-r--r-- | sys/vm/vm_param.h | 30 |
9 files changed, 10 insertions, 736 deletions
diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 4b9be5c4922..2ebc873fc66 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm.h,v 1.12 2001/04/06 23:41:01 art Exp $ */ +/* $OpenBSD: vm.h,v 1.13 2001/06/27 04:52:39 art Exp $ */ /* $NetBSD: vm.h,v 1.13 1994/06/29 06:47:52 cgd Exp $ */ /* @@ -53,22 +53,6 @@ typedef struct vm_map *vm_map_t; struct vm_page; typedef struct vm_page *vm_page_t; -#if !defined(UVM) -struct vm_object; -typedef struct vm_object *vm_object_t; - -struct pager_struct; -typedef struct pager_struct *vm_pager_t; - -/* - * MACH VM locking type mappings to kernel types - */ -typedef struct simplelock simple_lock_data_t; -typedef struct simplelock *simple_lock_t; -typedef struct lock lock_data_t; -typedef struct lock *lock_t; -#endif - #include <sys/vmmeter.h> #include <sys/queue.h> #include <vm/vm_param.h> diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index 530ee54267e..bd8f25f1b07 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_extern.h,v 1.19 2001/05/06 01:23:35 art Exp $ */ +/* $OpenBSD: vm_extern.h,v 1.20 2001/06/27 04:52:39 art Exp $ */ /* $NetBSD: vm_extern.h,v 1.20 1996/04/23 12:25:23 christos Exp $ */ /*- @@ -45,10 +45,6 @@ struct mount; struct vnode; struct core; -#if defined(KGDB) && !defined(UVM) -void chgkprot __P((caddr_t, int, int)); -#endif - #ifdef _KERNEL #ifdef TYPEDEF_FOR_UAP int compat_43_getpagesize __P((struct proc *p, void *, int *)); @@ -65,37 +61,6 @@ int sstk __P((struct proc *, void *, int *)); #endif void assert_wait __P((void *, boolean_t)); -#if !defined(UVM) -void iprintf __P((int (*)(const char *, ...), const char *, ...)); -int grow __P((struct proc *, vm_offset_t)); -int kernacc __P((caddr_t, int, int)); -vm_offset_t kmem_alloc __P((vm_map_t, vm_size_t)); -vm_offset_t kmem_alloc_pageable __P((vm_map_t, vm_size_t)); -vm_offset_t kmem_alloc_wait __P((vm_map_t, vm_size_t)); -void kmem_free __P((vm_map_t, vm_offset_t, vm_size_t)); -void kmem_free_wakeup __P((vm_map_t, vm_offset_t, vm_size_t)); -void kmem_init __P((vm_offset_t, vm_offset_t)); -vm_offset_t kmem_malloc __P((vm_map_t, vm_size_t, boolean_t)); -vm_map_t kmem_suballoc __P((vm_map_t, vm_offset_t *, vm_offset_t *, - vm_size_t, boolean_t)); -void loadav __P((struct loadavg *)); -void munmapfd __P((struct proc *, int)); -int pager_cache __P((vm_object_t, boolean_t)); -void sched __P((void)); -#ifdef __GNUC__ -void scheduler __P((void)) __attribute ((noreturn)); -#else -void scheduler __P((void)); -#endif -int svm_allocate __P((struct proc *, void *, int *)); -int svm_deallocate __P((struct proc *, void *, int *)); -int svm_inherit __P((struct proc *, void *, int *)); -int svm_protect __P((struct proc *, void *, int *)); -void swapinit __P((void)); -void swapout __P((struct proc *)); -void swapout_threads __P((void)); -int swfree __P((struct proc *, int)); -#endif /* !UVM */ void swstrategy __P((struct buf *)); void thread_block __P((char *)); void thread_sleep_msg __P((void *, simple_lock_t, @@ -111,45 +76,6 @@ void thread_sleep_msg __P((void *, simple_lock_t, * was solely a wrapper around wakeup. */ #define thread_wakeup wakeup -#if !defined(UVM) -int useracc __P((caddr_t, int, int)); -int vm_allocate __P((vm_map_t, vm_offset_t *, vm_size_t, - boolean_t)); -int vm_allocate_with_pager __P((vm_map_t, vm_offset_t *, - vm_size_t, boolean_t, vm_pager_t, vm_offset_t, boolean_t)); -int vm_coredump __P((struct proc *, struct vnode *, struct ucred *, - struct core *)); -int vm_deallocate __P((vm_map_t, vm_offset_t, vm_size_t)); -int vm_fault __P((vm_map_t, vm_offset_t, vm_prot_t, boolean_t)); -void vm_fault_copy_entry __P((vm_map_t, - vm_map_t, vm_map_entry_t, vm_map_entry_t)); -void vm_fault_unwire __P((vm_map_t, vm_offset_t, vm_offset_t)); -int vm_fault_wire __P((vm_map_t, vm_offset_t, vm_offset_t)); -#ifdef __FORK_BRAINDAMAGE -int vm_fork __P((struct proc *, struct proc *, void *, size_t)); -#else -void vm_fork __P((struct proc *, struct proc *, void *, size_t)); -#endif -int vm_inherit __P((vm_map_t, - vm_offset_t, vm_size_t, vm_inherit_t)); -void vm_init_limits __P((struct proc *)); -void vm_mem_init __P((void)); -int vm_mmap __P((vm_map_t, vm_offset_t *, vm_size_t, - vm_prot_t, vm_prot_t, int, caddr_t, vm_offset_t)); -int vm_protect __P((vm_map_t, - vm_offset_t, vm_size_t, boolean_t, vm_prot_t)); -void vm_set_page_size __P((void)); -void vmmeter __P((void)); -struct vmspace *vmspace_alloc __P((vm_offset_t, vm_offset_t, int)); -struct vmspace *vmspace_fork __P((struct vmspace *)); -void vmspace_free __P((struct vmspace *)); -void vmtotal __P((struct vmtotal *)); -void vnode_pager_setsize __P((struct vnode *, u_long)); -void vnode_pager_umount __P((struct mount *)); -boolean_t vnode_pager_uncache __P((struct vnode *)); -int vslock __P((caddr_t, u_int)); -int vsunlock __P((caddr_t, u_int)); -#endif /* !UVM */ /* Machine dependent portion */ void vmapbuf __P((struct buf *, vsize_t)); diff --git a/sys/vm/vm_kern.h b/sys/vm/vm_kern.h index 37b47261a57..9607c16155b 100644 --- a/sys/vm/vm_kern.h +++ b/sys/vm/vm_kern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_kern.h,v 1.3 1998/03/01 00:38:09 niklas Exp $ */ +/* $OpenBSD: vm_kern.h,v 1.4 2001/06/27 04:52:39 art Exp $ */ /* $NetBSD: vm_kern.h,v 1.11 1998/02/10 14:08:58 mrg Exp $ */ /* @@ -67,18 +67,9 @@ /* Kernel memory management definitions. */ -#if defined(UVM) extern vm_map_t buffer_map; extern vm_map_t exec_map; extern vm_map_t kernel_map; extern vm_map_t kmem_map; extern vm_map_t mb_map; extern vm_map_t phys_map; -#else -vm_map_t buffer_map; -vm_map_t exec_map; -vm_map_t kernel_map; -vm_map_t kmem_map; -vm_map_t mb_map; -vm_map_t phys_map; -#endif diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 515c9ec378c..6d88dfdf3cb 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_map.h,v 1.14 2001/05/10 14:51:21 art Exp $ */ +/* $OpenBSD: vm_map.h,v 1.15 2001/06/27 04:52:39 art Exp $ */ /* $NetBSD: vm_map.h,v 1.11 1995/03/26 20:39:10 jtc Exp $ */ /* @@ -72,9 +72,7 @@ #ifndef _VM_MAP_ #define _VM_MAP_ -#ifdef UVM #include <uvm/uvm_anon.h> -#endif /* * Types defined: @@ -93,14 +91,8 @@ */ union vm_map_object { -#ifdef UVM struct uvm_object *uvm_obj; /* UVM OBJECT */ struct vm_map *sub_map; /* belongs to another map */ -#else - struct vm_object *vm_object; /* object object */ - struct vm_map *sub_map; /* belongs to another map */ - struct vm_map *share_map; /* share map */ -#endif /* UVM */ }; /* @@ -116,30 +108,19 @@ struct vm_map_entry { vaddr_t end; /* end address */ union vm_map_object object; /* object I point to */ vsize_t offset; /* offset into object */ -#if defined(UVM) /* etype is a bitmap that replaces the following 4 items */ int etype; /* entry type */ -#else - boolean_t is_a_map; /* Is "object" a map? */ - boolean_t is_sub_map; /* Is "object" a submap? */ - /* Only in sharing maps: */ - boolean_t copy_on_write; /* is data copy-on-write */ - boolean_t needs_copy; /* does object need to be copied */ -#endif /* Only in task maps: */ vm_prot_t protection; /* protection code */ vm_prot_t max_protection; /* maximum protection */ vm_inherit_t inheritance; /* inheritance */ int wired_count; /* can be paged if == 0 */ -#ifdef UVM struct vm_aref aref; /* anonymous overlay */ int advice; /* madvise advice */ #define uvm_map_entry_stop_copy flags u_int8_t flags; /* flags */ #define UVM_MAP_STATIC 0x01 /* static map entry */ - -#endif /* UVM */ }; #define VM_MAPENT_ISWIRED(entry) ((entry)->wired_count != 0) @@ -149,7 +130,6 @@ struct vm_map_entry { * by address. A single hint is provided to start * searches again from the last successful search, * insertion, or removal. -#if defined(UVM) * * LOCKING PROTOCOL NOTES: * ----------------------- @@ -196,7 +176,6 @@ struct vm_map_entry { * is busy, and thread is attempting * to write-lock. must be tested * while `flags_lock' is asserted. -#endif */ struct vm_map { struct pmap * pmap; /* Physical map */ @@ -204,26 +183,18 @@ struct vm_map { struct vm_map_entry header; /* List of entries */ int nentries; /* Number of entries */ vsize_t size; /* virtual size */ -#ifndef UVM - boolean_t is_main_map; /* Am I a main map? */ -#endif int ref_count; /* Reference count */ simple_lock_data_t ref_lock; /* Lock for ref_count field */ vm_map_entry_t hint; /* hint for quick lookups */ simple_lock_data_t hint_lock; /* lock for hint storage */ vm_map_entry_t first_free; /* First free space hint */ -#ifdef UVM int flags; /* flags */ simple_lock_data_t flags_lock; /* Lock for flags field */ -#else - boolean_t entries_pageable; /* map entries pageable?? */ -#endif unsigned int timestamp; /* Version number */ #define min_offset header.start #define max_offset header.end }; -#ifdef UVM /* vm_map flags */ #define VM_MAP_PAGEABLE 0x01 /* ro: entries are pageable*/ #define VM_MAP_INTRSAFE 0x02 /* ro: interrupt safe map */ @@ -276,26 +247,6 @@ vmi_list_unlock(s) splx(s); } #endif /* _KERNEL */ -#endif /* UVM */ - -#ifndef UVM /* version handled elsewhere in uvm */ -/* - * Map versions are used to validate a previous lookup attempt. - * - * Since lookup operations may involve both a main map and - * a sharing map, it is necessary to have a timestamp from each. - * [If the main map timestamp has changed, the share_map and - * associated timestamp are no longer valid; the map version - * does not include a reference for the imbedded share_map.] - */ -typedef struct { - int main_timestamp; - vm_map_t share_map; - int share_timestamp; -} vm_map_version_t; -#endif /* UVM */ - -#ifdef UVM /* * VM map locking operations: @@ -448,50 +399,6 @@ do { \ wakeup(&(map)->flags); \ } while (0) #endif /* _KERNEL */ -#else /* UVM */ -/* - * Macros: vm_map_lock, etc. - * Function: - * Perform locking on the data portion of a map. - */ - -#include <sys/proc.h> /* XXX for curproc and p_pid */ - -#define vm_map_lock_drain_interlock(map) { \ - lockmgr(&(map)->lock, LK_DRAIN|LK_INTERLOCK, \ - &(map)->ref_lock, curproc); \ - (map)->timestamp++; \ -} -#ifdef DIAGNOSTIC -#define vm_map_lock(map) { \ - if (lockmgr(&(map)->lock, LK_EXCLUSIVE, NULL, curproc) != 0) { \ - panic("vm_map_lock: failed to get lock"); \ - } \ - (map)->timestamp++; \ -} -#else -#define vm_map_lock(map) { \ - lockmgr(&(map)->lock, LK_EXCLUSIVE, NULL, curproc); \ - (map)->timestamp++; \ -} -#endif /* DIAGNOSTIC */ -#define vm_map_unlock(map) \ - lockmgr(&(map)->lock, LK_RELEASE, NULL, curproc) -#define vm_map_lock_read(map) \ - lockmgr(&(map)->lock, LK_SHARED, NULL, curproc) -#define vm_map_unlock_read(map) \ - lockmgr(&(map)->lock, LK_RELEASE, NULL, curproc) -#define vm_map_set_recursive(map) { \ - simple_lock(&(map)->lk_interlock); \ - (map)->lk_flags |= LK_CANRECURSE; \ - simple_unlock(&(map)->lk_interlock); \ -} -#define vm_map_clear_recursive(map) { \ - simple_lock(&(map)->lk_interlock); \ - (map)->lk_flags &= ~LK_CANRECURSE; \ - simple_unlock(&(map)->lk_interlock); \ -} -#endif /* UVM */ /* * Functions implemented as macros @@ -512,53 +419,4 @@ do { \ #endif #endif -#if defined(_KERNEL) && !defined(UVM) -boolean_t vm_map_check_protection __P((vm_map_t, - vm_offset_t, vm_offset_t, vm_prot_t)); -int vm_map_copy __P((vm_map_t, vm_map_t, vm_offset_t, - vm_size_t, vm_offset_t, boolean_t, boolean_t)); -void vm_map_copy_entry __P((vm_map_t, - vm_map_t, vm_map_entry_t, vm_map_entry_t)); -struct pmap; -vm_map_t vm_map_create __P((struct pmap *, - vm_offset_t, vm_offset_t, boolean_t)); -void vm_map_deallocate __P((vm_map_t)); -int vm_map_delete __P((vm_map_t, vm_offset_t, vm_offset_t)); -vm_map_entry_t vm_map_entry_create __P((vm_map_t)); -void vm_map_entry_delete __P((vm_map_t, vm_map_entry_t)); -void vm_map_entry_dispose __P((vm_map_t, vm_map_entry_t)); -void vm_map_entry_unwire __P((vm_map_t, vm_map_entry_t)); -int vm_map_find __P((vm_map_t, vm_object_t, - vm_offset_t, vm_offset_t *, vm_size_t, boolean_t)); -int vm_map_findspace __P((vm_map_t, - vm_offset_t, vm_size_t, vm_offset_t *)); -int vm_map_inherit __P((vm_map_t, - vm_offset_t, vm_offset_t, vm_inherit_t)); -void vm_map_init __P((struct vm_map *, - vm_offset_t, vm_offset_t, boolean_t)); -int vm_map_insert __P((vm_map_t, - vm_object_t, vm_offset_t, vm_offset_t, vm_offset_t)); -int vm_map_lookup __P((vm_map_t *, vm_offset_t, vm_prot_t, - vm_map_entry_t *, vm_object_t *, vm_offset_t *, vm_prot_t *, - boolean_t *, boolean_t *)); -void vm_map_lookup_done __P((vm_map_t, vm_map_entry_t)); -boolean_t vm_map_lookup_entry __P((vm_map_t, - vm_offset_t, vm_map_entry_t *)); -int vm_map_pageable __P((vm_map_t, - vm_offset_t, vm_offset_t, boolean_t)); -int vm_map_clean __P((vm_map_t, - vm_offset_t, vm_offset_t, boolean_t, boolean_t)); -void vm_map_print __P((vm_map_t, boolean_t)); -void _vm_map_print __P((vm_map_t, boolean_t, - int (*)(const char *, ...))); -int vm_map_protect __P((vm_map_t, - vm_offset_t, vm_offset_t, vm_prot_t, boolean_t)); -void vm_map_reference __P((vm_map_t)); -int vm_map_remove __P((vm_map_t, vm_offset_t, vm_offset_t)); -void vm_map_simplify __P((vm_map_t, vm_offset_t)); -void vm_map_simplify_entry __P((vm_map_t, vm_map_entry_t)); -void vm_map_startup __P((void)); -int vm_map_submap __P((vm_map_t, - vm_offset_t, vm_offset_t, vm_map_t)); -#endif /* _KERNEL & !UVM */ #endif /* _VM_MAP_ */ diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 1364434568c..dc488104f49 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_object.h,v 1.10 2000/01/27 18:52:42 art Exp $ */ +/* $OpenBSD: vm_object.h,v 1.11 2001/06/27 04:52:40 art Exp $ */ /* $NetBSD: vm_object.h,v 1.16 1995/03/29 22:10:28 briggs Exp $ */ /* @@ -75,159 +75,4 @@ #include <vm/vm_page.h> #include <vm/vm_pager.h> -#if !defined(UVM) -/* - * Types defined: - * - * vm_object_t Virtual memory object. - */ - -struct vm_object { - struct pglist memq; /* Resident memory */ - TAILQ_ENTRY(vm_object) object_list; /* list of all objects */ - u_short flags; /* see below */ - u_short paging_in_progress; /* Paging (in or out) so - don't collapse or destroy */ - simple_lock_data_t Lock; /* Synchronization */ - int ref_count; /* How many refs?? */ - vm_size_t size; /* Object size */ - int resident_page_count; - /* number of resident pages */ - struct vm_object *copy; /* Object that holds copies of - my changed pages */ - vm_pager_t pager; /* Where to get data */ - vm_offset_t paging_offset; /* Offset into paging space */ - struct vm_object *shadow; /* My shadow */ - vm_offset_t shadow_offset; /* Offset in shadow */ - TAILQ_ENTRY(vm_object) cached_list; /* for persistence */ - LIST_HEAD(, vm_object) shadowers; /* set of shadowers */ - LIST_ENTRY(vm_object) shadowers_list; /* link to next shadower of - this object's shadow */ -}; - -/* - * Flags - */ -#define OBJ_CANPERSIST 0x0001 /* allow to persist */ -#define OBJ_INTERNAL 0x0002 /* internally created object */ -#define OBJ_ACTIVE 0x0004 /* used to mark active objects */ -#define OBJ_FADING 0x0008 /* tell others that the object is going away */ -#define OBJ_WAITING 0x8000 /* someone is waiting for paging to finish */ - -TAILQ_HEAD(vm_object_hash_head, vm_object_hash_entry); - -struct vm_object_hash_entry { - TAILQ_ENTRY(vm_object_hash_entry) hash_links; /* hash chain links */ - vm_object_t object; /* object represented */ -}; - -typedef struct vm_object_hash_entry *vm_object_hash_entry_t; - -#ifdef _KERNEL -TAILQ_HEAD(object_q, vm_object); - -struct object_q vm_object_cached_list; /* list of objects persisting */ -int vm_object_cached; /* size of cached list */ -simple_lock_data_t vm_cache_lock; /* lock for object cache */ - -struct object_q vm_object_list; /* list of allocated objects */ -long vm_object_count; /* count of all objects */ -simple_lock_data_t vm_object_list_lock; - /* lock for object list and count */ - -vm_object_t kernel_object; /* the single kernel object */ -vm_object_t kmem_object; - -#define vm_object_cache_lock() simple_lock(&vm_cache_lock) -#define vm_object_cache_unlock() simple_unlock(&vm_cache_lock) -#endif /* _KERNEL */ - -#define vm_object_lock_init(object) simple_lock_init(&(object)->Lock) -#define vm_object_lock(object) simple_lock(&(object)->Lock) -#define vm_object_unlock(object) simple_unlock(&(object)->Lock) -#define vm_object_lock_try(object) simple_lock_try(&(object)->Lock) - -#define vm_object_sleep(event, object, interruptible, where) \ - do { \ - (object)->flags |= OBJ_WAITING; \ - thread_sleep_msg((event), &(object)->Lock, \ - (interruptible), (where), 0); \ - } while (0) - -#define vm_object_wakeup(object) \ - do { \ - if ((object)->flags & OBJ_WAITING) { \ - (object)->flags &= ~OBJ_WAITING; \ - thread_wakeup((object)); \ - } \ - } while (0) - -#define vm_object_paging(object) \ - ((object)->paging_in_progress != 0) - -#ifndef DIAGNOSTIC -#define vm_object_paging_begin(object) \ - do { \ - (object)->paging_in_progress++; \ - } while (0) -#else -#define vm_object_paging_begin(object) \ - do { \ - if ((object)->paging_in_progress == 0xdead) \ - panic("vm_object_paging_begin"); \ - (object)->paging_in_progress++; \ - } while (0) -#endif - -#define vm_object_paging_end(object) \ - do { \ - if (--((object)->paging_in_progress) == 0) \ - vm_object_wakeup((object)); \ - } while (0) - -#define vm_object_paging_wait(object,msg) \ - do { \ - while (vm_object_paging((object))) { \ - vm_object_sleep((object), (object), FALSE, \ - (msg)); \ - vm_object_lock((object)); \ - } \ - } while (0) - -#ifdef _KERNEL -vm_object_t vm_object_allocate __P((vm_size_t)); -void vm_object_cache_clear __P((void)); -void vm_object_cache_trim __P((void)); -boolean_t vm_object_coalesce __P((vm_object_t, vm_object_t, - vm_offset_t, vm_offset_t, vm_offset_t, vm_size_t)); -void vm_object_collapse __P((vm_object_t)); -void vm_object_copy __P((vm_object_t, vm_offset_t, vm_size_t, - vm_object_t *, vm_offset_t *, boolean_t *)); -void vm_object_deactivate_pages __P((vm_object_t)); -void vm_object_deallocate __P((vm_object_t)); -void vm_object_enter __P((vm_object_t, vm_pager_t)); -void vm_object_init __P((vm_size_t)); -vm_object_t vm_object_lookup __P((vm_pager_t)); -boolean_t vm_object_page_clean __P((vm_object_t, - vm_offset_t, vm_offset_t, boolean_t, boolean_t)); -void vm_object_page_remove __P((vm_object_t, - vm_offset_t, vm_offset_t)); -void vm_object_pmap_copy __P((vm_object_t, - vm_offset_t, vm_offset_t)); -void vm_object_pmap_remove __P((vm_object_t, - vm_offset_t, vm_offset_t)); -void vm_object_prefer __P((vm_object_t, - vm_offset_t, vm_offset_t *)); -void vm_object_print __P((vm_object_t, boolean_t)); -void _vm_object_print __P((vm_object_t, boolean_t, - int (*)(const char *, ...))); -void vm_object_reference __P((vm_object_t)); -void vm_object_remove __P((vm_pager_t)); -void vm_object_setpager __P((vm_object_t, - vm_pager_t, vm_offset_t, boolean_t)); -void vm_object_shadow __P((vm_object_t *, - vm_offset_t *, vm_size_t)); -void vm_object_terminate __P((vm_object_t)); -#endif -#endif /* UVM */ #endif /* _VM_OBJECT_ */ diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 299ca111e9f..782dfb6e027 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_page.h,v 1.12 2001/04/07 17:13:44 niklas Exp $ */ +/* $OpenBSD: vm_page.h,v 1.13 2001/06/27 04:52:40 art Exp $ */ /* $NetBSD: vm_page.h,v 1.24 1998/02/10 14:09:03 mrg Exp $ */ /* @@ -96,7 +96,6 @@ * queues (P) [or both]. */ -#if defined(UVM) /* * locking note: the mach version of this data structure had bit * fields for the flags, and the bit fields were divided into two @@ -110,7 +109,6 @@ */ #include <uvm/uvm_extern.h> -#endif /* UVM */ #include <vm/pglist.h> struct vm_page { @@ -119,12 +117,8 @@ struct vm_page { TAILQ_ENTRY(vm_page) hashq; /* hash table links (O)*/ TAILQ_ENTRY(vm_page) listq; /* pages in same object (O)*/ -#if !defined(UVM) /* uvm uses obju */ - vm_object_t object; /* which object am I in (O,P)*/ -#endif vaddr_t offset; /* offset into object (O,P) */ -#if defined(UVM) struct uvm_object *uobject; /* object (O,P) */ struct vm_anon *uanon; /* anon (O,P) */ u_short flags; /* object flags [O] */ @@ -134,13 +128,9 @@ struct vm_page { u_int loan_count; /* number of active loans * to read: [O or P] * to modify: [O _and_ P] */ -#else - u_short wire_count; /* wired down maps refs (P) */ - u_short flags; /* see below */ -#endif paddr_t phys_addr; /* physical address of page */ -#if defined(UVM) && defined(UVM_PAGE_TRKOWN) +#if defined(UVM_PAGE_TRKOWN) /* debugging fields to track page ownership */ pid_t owner; /* proc that set PG_BUSY */ char *owner_tag; /* why it was set busy */ @@ -152,7 +142,6 @@ struct vm_page { * * Note: PG_FILLED and PG_DIRTY are added for the filesystems. */ -#if defined(UVM) /* * locking rules: @@ -184,35 +173,6 @@ struct vm_page { #define PQ_SWAPBACKED (PQ_ANON|PQ_AOBJ) #define PQ_ENCRYPT 0x0040 /* page needs {en,de}cryption */ -#else -#define PG_INACTIVE 0x0001 /* page is in inactive list (P) */ -#define PG_ACTIVE 0x0002 /* page is in active list (P) */ -#define PG_LAUNDRY 0x0004 /* page is being cleaned now (P) */ -#define PG_CLEAN 0x0008 /* page has not been modified - There exists a case where this bit - will be cleared, although the page - is not physically dirty, which is - when a collapse operation moves - pages between two different pagers. - The bit is then used as a marker - for the pageout daemon to know it - should be paged out into the target - pager. */ -#define PG_BUSY 0x0010 /* page is in transit (O) */ -#define PG_WANTED 0x0020 /* someone is waiting for page (O) */ -#define PG_TABLED 0x0040 /* page is in VP table (O) */ -#define PG_COPYONWRITE 0x0080 /* must copy page before changing (O) */ -#define PG_FICTITIOUS 0x0100 /* physical page doesn't exist (O) */ -#define PG_FAKE 0x0200 /* page is placeholder for pagein (O) */ -#define PG_FILLED 0x0400 /* client flag to set when filled */ -#define PG_DIRTY 0x0800 /* client flag to set when dirty */ -#define PG_FREE 0x1000 /* XXX page is on free list */ -#define PG_FAULTING 0x2000 /* page is being faulted in */ -#define PG_PAGEROWNED 0x4000 /* DEBUG: async paging op in progress */ -#define PG_PTPAGE 0x8000 /* DEBUG: is a user page table page */ -#endif - -#if defined(MACHINE_NEW_NONCONTIG) /* * physical memory layout structure * @@ -239,16 +199,12 @@ struct vm_physseg { vaddr_t end; /* (PF# of last page in segment) + 1 */ vaddr_t avail_start; /* PF# of first free page in segment */ vaddr_t avail_end; /* (PF# of last free page in segment) +1 */ -#if defined(UVM) int free_list; /* which free list they belong on */ -#endif struct vm_page *pgs; /* vm_page structures (from start) */ struct vm_page *lastpg; /* vm_page structure for end */ struct pmap_physseg pmseg; /* pmap specific (MD) data */ }; -#endif /* MACHINE_NEW_NONCONTIG */ - #if defined(_KERNEL) /* @@ -274,9 +230,6 @@ struct pglist vm_page_queue_active; /* active memory queue */ extern struct pglist vm_page_queue_inactive; /* inactive memory queue */ - -#if defined(MACHINE_NEW_NONCONTIG) - /* * physical memory config is stored in vm_physmem. */ @@ -284,89 +237,18 @@ struct pglist vm_page_queue_inactive; /* inactive memory queue */ extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX]; extern int vm_nphysseg; -#else -#if defined(MACHINE_NONCONTIG) -/* OLD NONCONTIG CODE: NUKE NUKE NUKE ONCE CONVERTED */ -extern -u_long first_page; /* first physical page number */ -extern -int vm_page_count; /* How many pages do we manage? */ -extern -vm_page_t vm_page_array; /* First resident page in table */ - -#define VM_PAGE_INDEX(pa) \ - (pmap_page_index((pa)) - first_page) -#else -/* OLD CONTIG CODE: NUKE NUKE NUKE ONCE CONVERTED */ -extern -long first_page; /* first physical page number */ - /* ... represented in vm_page_array */ -extern -long last_page; /* last physical page number */ - /* ... represented in vm_page_array */ - /* [INCLUSIVE] */ -extern -vm_offset_t first_phys_addr; /* physical address for first_page */ -extern -vm_offset_t last_phys_addr; /* physical address for last_page */ -extern -vm_page_t vm_page_array; /* First resident page in table */ - -#define VM_PAGE_INDEX(pa) \ - (atop((pa)) - first_page) - -#endif /* MACHINE_NONCONTIG */ -#endif /* MACHINE_NEW_NONCONTIG */ - /* * prototypes */ -#if defined(MACHINE_NEW_NONCONTIG) static struct vm_page *PHYS_TO_VM_PAGE __P((paddr_t)); static int vm_physseg_find __P((paddr_t, int *)); -#endif - -#if !defined(UVM) -void vm_page_activate __P((vm_page_t)); -vm_page_t vm_page_alloc __P((vm_object_t, vm_offset_t)); -vm_offset_t vm_page_alloc_contig(vm_offset_t, vm_offset_t, - vm_offset_t, vm_offset_t); -int vm_page_alloc_memory __P((vm_size_t size, vm_offset_t low, - vm_offset_t high, vm_offset_t alignment, vm_offset_t boundary, - struct pglist *rlist, int nsegs, int waitok)); -void vm_page_free_memory __P((struct pglist *list)); -#if defined(MACHINE_NONCONTIG) || defined(MACHINE_NEW_NONCONTIG) -void vm_page_bootstrap __P((vm_offset_t *, vm_offset_t *)); -vm_offset_t vm_bootstrap_steal_memory __P((vm_size_t)); -#endif -void vm_page_copy __P((vm_page_t, vm_page_t)); -void vm_page_deactivate __P((vm_page_t)); -void vm_page_free __P((vm_page_t)); -void vm_page_insert __P((vm_page_t, vm_object_t, vm_offset_t)); -vm_page_t vm_page_lookup __P((vm_object_t, vm_offset_t)); -#if defined(MACHINE_NEW_NONCONTIG) -void vm_page_physload __P((vm_offset_t, vm_offset_t, - vm_offset_t, vm_offset_t)); -void vm_page_physrehash __P((void)); -#endif -void vm_page_remove __P((vm_page_t)); -void vm_page_rename __P((vm_page_t, vm_object_t, vm_offset_t)); -#if !defined(MACHINE_NONCONTIG) && !defined(MACHINE_NEW_NONCONTIG) -void vm_page_startup __P((vm_offset_t *, vm_offset_t *)); -#endif -void vm_page_unwire __P((vm_page_t)); -void vm_page_wire __P((vm_page_t)); -boolean_t vm_page_zero_fill __P((vm_page_t)); -#endif /* * macros and inlines */ #define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr) -#if defined(MACHINE_NEW_NONCONTIG) - /* * when VM_PHYSSEG_MAX is 1, we can simplify these functions */ @@ -470,36 +352,8 @@ PHYS_TO_VM_PAGE(pa) return(NULL); } -#elif defined(MACHINE_NONCONTIG) - -/* OLD NONCONTIG CODE: NUKE NUKE NUKE ONCE CONVERTED */ -#define IS_VM_PHYSADDR(pa) \ - (pmap_page_index(pa) >= 0) - -#define PHYS_TO_VM_PAGE(pa) \ - (&vm_page_array[pmap_page_index(pa) - first_page]) - -#else - -/* OLD CONTIG CODE: NUKE NUKE NUKE ONCE CONVERTED */ -#define IS_VM_PHYSADDR(pa) \ - ((pa) >= first_phys_addr && (pa) <= last_phys_addr) - -#define PHYS_TO_VM_PAGE(pa) \ - (&vm_page_array[atop(pa) - first_page ]) - -#endif /* (OLD) MACHINE_NONCONTIG */ - -#if defined(UVM) - #define VM_PAGE_IS_FREE(entry) ((entry)->pqflags & PQ_FREE) -#else /* UVM */ - -#define VM_PAGE_IS_FREE(entry) ((entry)->flags & PG_FREE) - -#endif /* UVM */ - extern simple_lock_data_t vm_page_queue_lock; /* lock on active and inactive page queues */ @@ -527,13 +381,6 @@ simple_lock_data_t vm_page_queue_free_lock; /* * XXXCDC: different versions of this should die */ -#if !defined(MACHINE_NONCONTIG) && !defined(MACHINE_NEW_NONCONTIG) -#define VM_PAGE_INIT(mem, obj, offset) { \ - (mem)->flags = PG_BUSY | PG_CLEAN | PG_FAKE; \ - vm_page_insert((mem), (obj), (offset)); \ - (mem)->wire_count = 0; \ -} -#else /* MACHINE_NONCONTIG */ #define VM_PAGE_INIT(mem, obj, offset) { \ (mem)->flags = PG_BUSY | PG_CLEAN | PG_FAKE; \ if (obj) \ @@ -542,10 +389,8 @@ simple_lock_data_t vm_page_queue_free_lock; (mem)->object = NULL; \ (mem)->wire_count = 0; \ } -#endif /* MACHINE_NONCONTIG */ #if VM_PAGE_DEBUG -#if defined(MACHINE_NEW_NONCONTIG) /* * VM_PAGE_CHECK: debugging check of a vm_page structure @@ -567,32 +412,6 @@ VM_PAGE_CHECK(mem) return; } -#elif defined(MACHINE_NONCONTIG) - -/* OLD NONCONTIG CODE: NUKE NUKE NUKE ONCE CONVERTED */ -#define VM_PAGE_CHECK(mem) { \ - if ((((unsigned int) mem) < ((unsigned int) &vm_page_array[0])) || \ - (((unsigned int) mem) > \ - ((unsigned int) &vm_page_array[vm_page_count])) || \ - ((mem->flags & (PG_ACTIVE | PG_INACTIVE)) == \ - (PG_ACTIVE | PG_INACTIVE))) \ - panic("vm_page_check: not valid!"); \ -} - -#else - -/* OLD CONTIG CODE: NUKE NUKE NUKE ONCE CONVERTED */ -#define VM_PAGE_CHECK(mem) { \ - if ((((unsigned int) mem) < ((unsigned int) &vm_page_array[0])) || \ - (((unsigned int) mem) > \ - ((unsigned int) &vm_page_array[last_page-first_page])) || \ - ((mem->flags & (PG_ACTIVE | PG_INACTIVE)) == \ - (PG_ACTIVE | PG_INACTIVE))) \ - panic("vm_page_check: not valid!"); \ -} - -#endif - #else /* VM_PAGE_DEBUG */ #define VM_PAGE_CHECK(mem) #endif /* VM_PAGE_DEBUG */ diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h index ce6c657718e..218baad520b 100644 --- a/sys/vm/vm_pageout.h +++ b/sys/vm/vm_pageout.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_pageout.h,v 1.7 2000/03/15 14:16:12 art Exp $ */ +/* $OpenBSD: vm_pageout.h,v 1.8 2001/06/27 04:52:40 art Exp $ */ /* $NetBSD: vm_pageout.h,v 1.14 1998/02/10 14:09:04 mrg Exp $ */ /* @@ -69,31 +69,3 @@ * Header file for pageout daemon. */ -#if !defined(UVM) -/* - * Exported data structures. - */ - -extern int vm_pages_needed; /* should be some "event" structure */ -simple_lock_data_t vm_pages_needed_lock; - -struct proc *pageout_daemon; /* watch for this in vm_fault()!! */ -u_int32_t vm_pages_reserved; /* i.e., reserved for pageout_daemon */ - - -/* - * Exported routines. - */ - -/* - * Signal pageout-daemon and wait for it. - */ - -#ifdef _KERNEL -void vm_wait __P((char *)); -void vm_pageout __P((void)); -void vm_pageout_scan __P((void)); -void vm_pageout_page __P((vm_page_t, vm_object_t)); -void vm_pageout_cluster __P((vm_page_t, vm_object_t)); -#endif -#endif diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 949bd276f88..917a0c14c4f 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_pager.h,v 1.7 1999/08/18 14:05:39 art Exp $ */ +/* $OpenBSD: vm_pager.h,v 1.8 2001/06/27 04:52:40 art Exp $ */ /* $NetBSD: vm_pager.h,v 1.10 1995/03/26 20:39:15 jtc Exp $ */ /* @@ -49,62 +49,6 @@ #ifndef _VM_PAGER_ #define _VM_PAGER_ -#if !defined(UVM) -TAILQ_HEAD(pagerlst, pager_struct); - -struct pager_struct { - TAILQ_ENTRY(pager_struct) pg_list; /* links for list management */ - caddr_t pg_handle; /* ext. handle (vp, dev, fp) */ - int pg_type; /* type of pager */ - int pg_flags; /* flags */ - struct pagerops *pg_ops; /* pager operations */ - void *pg_data; /* private pager data */ -}; - -/* pager types */ -#define PG_DFLT -1 -#define PG_SWAP 0 -#define PG_VNODE 1 -#define PG_DEVICE 2 - -/* flags */ -#define PG_CLUSTERGET 1 -#define PG_CLUSTERPUT 2 - -struct pagerops { - void (*pgo_init) /* Initialize pager. */ - __P((void)); - vm_pager_t (*pgo_alloc) /* Allocate pager. */ - __P((caddr_t, vm_size_t, vm_prot_t, vm_offset_t)); - void (*pgo_dealloc) /* Disassociate. */ - __P((vm_pager_t)); - int (*pgo_getpages) /* Get (read) pages. */ - __P((vm_pager_t, vm_page_t *, int, boolean_t)); - int (*pgo_putpages) /* Put (write) pages. */ - __P((vm_pager_t, vm_page_t *, int, boolean_t)); - boolean_t (*pgo_haspage) /* Does pager have page? */ - __P((vm_pager_t, vm_offset_t)); - void (*pgo_cluster) /* Return range of cluster. */ - __P((vm_pager_t, vm_offset_t, - vm_offset_t *, vm_offset_t *)); - /* - * The following are an extension to the original Mach pager - * interface first seen in BSD/OS 2.1 (at least as far as I am - * aware). As compatibility is a good thing (tm) I choose to - * use that interface extension instead of coming up with one - * of my own (the interface must be extended to make the - * object collapse operation work in the presense of pagers). - * -- Niklas Hallqvist (niklas@appli.se). - */ - int (*pgo_remove) /* Don't manage range anymore */ - __P((vm_pager_t, vm_offset_t, vm_offset_t)); - vm_offset_t (*pgo_next) /* Find next page in pager. */ - __P((vm_pager_t, vm_offset_t)); - int (*pgo_count) /* How many pages in pager? */ - __P((vm_pager_t)); -}; -#endif /* !UVM */ - /* * get/put return values * OK operation was successful @@ -126,41 +70,4 @@ struct pagerops { #define VM_PAGER_UNLOCK 6 #define VM_PAGER_REFAULT 7 -#if defined(_KERNEL) && !defined(UVM) -extern struct pagerops *dfltpagerops; - -vm_pager_t vm_pager_allocate - __P((int, caddr_t, vm_size_t, vm_prot_t, vm_offset_t)); -vm_page_t vm_pager_atop __P((vm_offset_t)); -void vm_pager_cluster - __P((vm_pager_t, vm_offset_t, - vm_offset_t *, vm_offset_t *)); -void vm_pager_clusternull - __P((vm_pager_t, vm_offset_t, - vm_offset_t *, vm_offset_t *)); -void vm_pager_deallocate __P((vm_pager_t)); -int vm_pager_remove - __P((vm_pager_t, vm_offset_t, vm_offset_t)); -int vm_pager_count __P((vm_pager_t)); -vm_offset_t vm_pager_next __P((vm_pager_t, vm_offset_t)); -int vm_pager_get_pages - __P((vm_pager_t, vm_page_t *, int, boolean_t)); -boolean_t vm_pager_has_page __P((vm_pager_t, vm_offset_t)); -void vm_pager_init __P((void)); -vm_pager_t vm_pager_lookup __P((struct pagerlst *, caddr_t)); -vm_offset_t vm_pager_map_pages __P((vm_page_t *, int, boolean_t)); -int vm_pager_put_pages - __P((vm_pager_t, vm_page_t *, int, boolean_t)); -void vm_pager_sync __P((void)); -void vm_pager_unmap_pages __P((vm_offset_t, int)); - -#define vm_pager_cancluster(p, b) ((p)->pg_flags & (b)) - -/* - * XXX compat with old interface - */ -int vm_pager_get __P((vm_pager_t, vm_page_t, boolean_t)); -int vm_pager_put __P((vm_pager_t, vm_page_t, boolean_t)); -#endif /* _KERNEL && !UVM */ - #endif /* _VM_PAGER_ */ diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h index e7abee33d53..b1b037ed320 100644 --- a/sys/vm/vm_param.h +++ b/sys/vm/vm_param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_param.h,v 1.21 2001/05/05 21:26:47 art Exp $ */ +/* $OpenBSD: vm_param.h,v 1.22 2001/06/27 04:52:40 art Exp $ */ /* $NetBSD: vm_param.h,v 1.12 1995/03/26 20:39:16 jtc Exp $ */ /* @@ -105,41 +105,18 @@ typedef int boolean_t; #undef PAGE_SIZE #undef PAGE_MASK #undef PAGE_SHIFT -#if defined(UVM) #define PAGE_SIZE uvmexp.pagesize /* size of page */ #define PAGE_MASK uvmexp.pagemask /* size of page - 1 */ #define PAGE_SHIFT uvmexp.pageshift /* bits to shift for pages */ -#else -#define PAGE_SIZE cnt.v_page_size /* size of page */ -#define PAGE_MASK page_mask /* size of page - 1 */ -#define PAGE_SHIFT page_shift /* bits to shift for pages */ -#endif /* UVM */ #endif /* !PAGE_SIZE */ #endif /* _KERNEL */ -#if defined(_KERNEL) && !defined(UVM) -extern vsize_t page_mask; -extern int page_shift; -#endif - /* * CTL_VM identifiers */ #define VM_METER 1 /* struct vmmeter */ #define VM_LOADAVG 2 /* struct loadavg */ #define VM_PSSTRINGS 3 /* PSSTRINGS */ -#if !defined(UVM) -#define VM_MAXID 4 /* number of valid vm ids */ - -#define CTL_VM_NAMES { \ - { 0, 0 }, \ - { "vmmeter", CTLTYPE_STRUCT }, \ - { "loadavg", CTLTYPE_STRUCT }, \ - { "psstrings", CTLTYPE_STRUCT }, \ -} - -#else - #define VM_UVMEXP 4 /* struct uvmexp */ #define VM_SWAPENCRYPT 5 /* int */ #define VM_MAXID 6 /* number of valid vm ids */ @@ -152,7 +129,6 @@ extern int page_shift; { "uvmexp", CTLTYPE_STRUCT }, \ { "swapencrypt", CTLTYPE_NODE }, \ } -#endif struct _ps_strings { void *val; @@ -191,10 +167,6 @@ struct _ps_strings { (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_page(x) \ ((x) & ~PAGE_MASK) -#if !defined(UVM) -#define num_pages(x) \ - ((vaddr_t)((((vaddr_t)(x)) + PAGE_MASK) >> PAGE_SHIFT)) -#endif #else /* out-of-kernel versions of round_page and trunc_page */ |