Deleted Added
full compact
vm_page.h (8010) vm_page.h (9507)
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_page.h,v 1.17 1995/03/26 23:33:14 davidg Exp $
64 * $Id: vm_page.h,v 1.18 1995/04/23 08:05:49 bde Exp $
65 */
66
67/*
68 * Resident memory system definitions.
69 */
70
71#ifndef _VM_PAGE_
72#define _VM_PAGE_

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

131#define PG_COPYONWRITE 0x0080 /* must copy page before changing (O) */
132#define PG_FICTITIOUS 0x0100 /* physical page doesn't exist (O) */
133#define PG_WRITEABLE 0x0200 /* page is mapped writeable */
134#define PG_MAPPED 0x0400 /* page is mapped */
135#define PG_REFERENCED 0x1000 /* page has been referenced */
136#define PG_CACHE 0x4000 /* On VMIO cache */
137#define PG_FREE 0x8000 /* page is in free list */
138
65 */
66
67/*
68 * Resident memory system definitions.
69 */
70
71#ifndef _VM_PAGE_
72#define _VM_PAGE_

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

131#define PG_COPYONWRITE 0x0080 /* must copy page before changing (O) */
132#define PG_FICTITIOUS 0x0100 /* physical page doesn't exist (O) */
133#define PG_WRITEABLE 0x0200 /* page is mapped writeable */
134#define PG_MAPPED 0x0400 /* page is mapped */
135#define PG_REFERENCED 0x1000 /* page has been referenced */
136#define PG_CACHE 0x4000 /* On VMIO cache */
137#define PG_FREE 0x8000 /* page is in free list */
138
139#if VM_PAGE_DEBUG
140#define VM_PAGE_CHECK(mem) { \
141 if ((((unsigned int) mem) < ((unsigned int) &vm_page_array[0])) || \
142 (((unsigned int) mem) > \
143 ((unsigned int) &vm_page_array[last_page-first_page])) || \
144 ((mem->flags & (PG_ACTIVE | PG_INACTIVE)) == \
145 (PG_ACTIVE | PG_INACTIVE))) \
146 panic("vm_page_check: not valid!"); \
147}
148#else /* VM_PAGE_DEBUG */
149#define VM_PAGE_CHECK(mem)
150#endif /* VM_PAGE_DEBUG */
139/*
140 * Misc constants.
141 */
151
142
143#define ACT_DECLINE 1
144#define ACT_ADVANCE 3
145#define ACT_MAX 100
146#define PFCLUSTER_BEHIND 3
147#define PFCLUSTER_AHEAD 3
148
152#ifdef KERNEL
153/*
149#ifdef KERNEL
150/*
154 * Each pageable resident page falls into one of three lists:
151 * Each pageable resident page falls into one of four lists:
155 *
156 * free
157 * Available for allocation now.
152 *
153 * free
154 * Available for allocation now.
155 *
156 * The following are all LRU sorted:
157 *
158 * cache
159 * Almost available for allocation. Still in an
160 * object, but clean and immediately freeable at
161 * non-interrupt times.
162 *
158 * inactive
163 * inactive
159 * Not referenced in any map, but still has an
160 * object/offset-page mapping, and may be dirty.
164 * Low activity, candidates for reclaimation.
161 * This is the list of pages that should be
162 * paged out next.
165 * This is the list of pages that should be
166 * paged out next.
167 *
163 * active
168 * active
164 * A list of pages which have been placed in
165 * at least one physical map. This list is
166 * ordered, in LRU-like fashion.
169 * Pages that are "active" i.e. they have been
170 * recently referenced.
167 */
168
169extern struct pglist vm_page_queue_free; /* memory free queue */
170extern struct pglist vm_page_queue_active; /* active memory queue */
171extern struct pglist vm_page_queue_inactive; /* inactive memory queue */
172extern struct pglist vm_page_queue_cache; /* cache memory queue */
173
174extern vm_page_t vm_page_array; /* First resident page in table */

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

185#define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr)
186
187#define IS_VM_PHYSADDR(pa) \
188 ((pa) >= first_phys_addr && (pa) <= last_phys_addr)
189
190#define PHYS_TO_VM_PAGE(pa) \
191 (&vm_page_array[atop(pa) - first_page ])
192
171 */
172
173extern struct pglist vm_page_queue_free; /* memory free queue */
174extern struct pglist vm_page_queue_active; /* active memory queue */
175extern struct pglist vm_page_queue_inactive; /* inactive memory queue */
176extern struct pglist vm_page_queue_cache; /* cache memory queue */
177
178extern vm_page_t vm_page_array; /* First resident page in table */

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

189#define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr)
190
191#define IS_VM_PHYSADDR(pa) \
192 ((pa) >= first_phys_addr && (pa) <= last_phys_addr)
193
194#define PHYS_TO_VM_PAGE(pa) \
195 (&vm_page_array[atop(pa) - first_page ])
196
193extern simple_lock_data_t vm_page_queue_lock; /* lock on active and inactive page queues */
194extern simple_lock_data_t vm_page_queue_free_lock; /* lock on free page queue */
195
196/*
197 * Functions implemented as macros
198 */
199
200#define PAGE_ASSERT_WAIT(m, interruptible) { \
201 (m)->flags |= PG_WANTED; \
202 assert_wait((int) (m), (interruptible)); \
203 }
204
205#define PAGE_WAKEUP(m) { \
206 (m)->flags &= ~PG_BUSY; \
207 if ((m)->flags & PG_WANTED) { \
208 (m)->flags &= ~PG_WANTED; \
209 wakeup((caddr_t) (m)); \
210 } \
211 }
212
197/*
198 * Functions implemented as macros
199 */
200
201#define PAGE_ASSERT_WAIT(m, interruptible) { \
202 (m)->flags |= PG_WANTED; \
203 assert_wait((int) (m), (interruptible)); \
204 }
205
206#define PAGE_WAKEUP(m) { \
207 (m)->flags &= ~PG_BUSY; \
208 if ((m)->flags & PG_WANTED) { \
209 (m)->flags &= ~PG_WANTED; \
210 wakeup((caddr_t) (m)); \
211 } \
212 }
213
213#define vm_page_lock_queues() simple_lock(&vm_page_queue_lock)
214#define vm_page_unlock_queues() simple_unlock(&vm_page_queue_lock)
215
216#if PAGE_SIZE == 4096
217#define VM_PAGE_BITS_ALL 0xff
218#endif
219
220#if PAGE_SIZE == 8192
221#define VM_PAGE_BITS_ALL 0xffff
222#endif
223

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

288 } else if ((prot == VM_PROT_READ) && (mem->flags & PG_WRITEABLE)) {
289 pmap_page_protect(VM_PAGE_TO_PHYS(mem), prot);
290 mem->flags &= ~PG_WRITEABLE;
291 }
292}
293
294
295#endif /* KERNEL */
214#if PAGE_SIZE == 4096
215#define VM_PAGE_BITS_ALL 0xff
216#endif
217
218#if PAGE_SIZE == 8192
219#define VM_PAGE_BITS_ALL 0xffff
220#endif
221

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

286 } else if ((prot == VM_PROT_READ) && (mem->flags & PG_WRITEABLE)) {
287 pmap_page_protect(VM_PAGE_TO_PHYS(mem), prot);
288 mem->flags &= ~PG_WRITEABLE;
289 }
290}
291
292
293#endif /* KERNEL */
296
297#define ACT_DECLINE 1
298#define ACT_ADVANCE 3
299#define ACT_MAX 100
300
301#endif /* !_VM_PAGE_ */
294#endif /* !_VM_PAGE_ */