Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor clean

  • Loading branch information...
commit f3c6c2a9ca0ffea7ca1055e946808565aba7496a 1 parent b691374
cgd authored
View
4 sys/vm/vm_fault.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_fault.c 7.6 (Berkeley) 5/7/91
- * $Id: vm_fault.c,v 1.11.2.2 1994/04/15 04:24:27 cgd Exp $
+ * $Id: vm_fault.c,v 1.11.2.3 1994/04/15 06:28:02 cgd Exp $
*
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
@@ -114,7 +114,7 @@ vm_fault(map, vaddr, fault_type, change_wiring)
vm_page_t old_m;
vm_object_t next_object;
- cnt.v_faults++; /* needs lock XXX */
+ cnt.v_vm_faults++; /* needs lock XXX */
/*
* Recovery actions
*/
View
10 sys/vm/vm_mmap.c
@@ -37,7 +37,7 @@
*
* from: Utah Hdr: vm_mmap.c 1.3 90/01/21
* from: @(#)vm_mmap.c 7.5 (Berkeley) 6/28/91
- * $Id: vm_mmap.c,v 1.18.2.3 1994/04/15 01:54:43 cgd Exp $
+ * $Id: vm_mmap.c,v 1.18.2.4 1994/04/15 06:28:04 cgd Exp $
*/
/*
@@ -155,7 +155,7 @@ smmap(p, uap, retval) /* XXX SHOULD BE mmap() */
* Size is implicitly rounded to a page boundary.
*/
addr = (vm_offset_t) uap->addr;
- if ((flags & MAP_FIXED) && (addr & page_mask) || uap->len < 0)
+ if ((flags & MAP_FIXED) && (addr & PAGE_MASK) || uap->len < 0)
return(EINVAL);
size = (vm_size_t) round_page(uap->len);
if ((flags & MAP_FIXED) && (addr + size > VM_MAXUSER_ADDRESS))
@@ -349,7 +349,7 @@ msync(p, uap, retval)
printf("msync(%d): addr %x len %x\n",
p->p_pid, uap->addr, uap->len);
#endif
- if (((int)uap->addr & page_mask) || uap->len < 0)
+ if (((int)uap->addr & PAGE_MASK) || uap->len < 0)
return(EINVAL);
addr = oaddr = (vm_offset_t)uap->addr;
osize = (vm_size_t)uap->len;
@@ -420,7 +420,7 @@ munmap(p, uap, retval)
p->p_pid, uap->addr, uap->len);
#endif
addr = (vm_offset_t) uap->addr;
- if ((addr & page_mask) || uap->len < 0)
+ if ((addr & PAGE_MASK) || uap->len < 0)
return(EINVAL);
size = (vm_size_t) round_page(uap->len);
if (size == 0)
@@ -473,7 +473,7 @@ mprotect(p, uap, retval)
p->p_pid, uap->addr, uap->len, uap->prot);
#endif
addr = (vm_offset_t) uap->addr;
- if ((addr & page_mask) || uap->len < 0)
+ if ((addr & PAGE_MASK) || uap->len < 0)
return(EINVAL);
size = (vm_size_t) uap->len;
/*
View
29 sys/vm/vm_page.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91
- * $Id: vm_page.c,v 1.12.2.2 1994/04/15 04:24:30 cgd Exp $
+ * $Id: vm_page.c,v 1.12.2.3 1994/04/15 06:28:07 cgd Exp $
*
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
@@ -96,11 +96,6 @@ int vm_page_bucket_count = 0; /* How big is array? */
int vm_page_hash_mask; /* Mask for hash function */
simple_lock_data_t bucket_lock; /* lock for all buckets XXX */
-/* XXX XXX XXX */
-vm_size_t page_size = 4096;
-vm_size_t page_mask = 4095;
-int page_shift = 12;
-
struct pglist vm_page_queue_free;
struct pglist vm_page_queue_active;
struct pglist vm_page_queue_inactive;
@@ -118,6 +113,8 @@ vm_offset_t last_phys_addr;
u_long first_page;
int vm_page_count;
#endif /* MACHINE_NONCONTIG */
+vm_size_t page_mask;
+int page_shift;
/*
* vm_set_page_size:
@@ -131,13 +128,14 @@ int vm_page_count;
void
vm_set_page_size()
{
- page_mask = page_size - 1;
- if ((page_mask & page_size) != 0)
+ if (cnt.v_page_size == 0)
+ cnt.v_page_size = DEFAULT_PAGE_SIZE;
+ page_mask = cnt.v_page_size - 1;
+ if ((page_mask & cnt.v_page_size) != 0)
panic("vm_set_page_size: page size not a power of two");
-
for (page_shift = 0; ; page_shift++)
- if ((1 << page_shift) == page_size)
+ if ((1 << page_shift) == cnt.v_page_size)
break;
}
@@ -394,7 +392,7 @@ vm_page_startup(start, end, vaddr)
last_page = first_page + npages - 1;
first_phys_addr = ptoa(first_page);
- last_phys_addr = ptoa(last_page) + page_mask;
+ last_phys_addr = ptoa(last_page) + PAGE_MASK;
/*
* Validate these addresses.
@@ -438,12 +436,17 @@ pmap_steal_memory(size)
vm_size_t size;
{
vm_offset_t addr, vaddr, paddr;
-
+
+#ifdef i386 /* XXX i386 calls pmap_steal_memory before vm_mem_init() */
+ if (cnt.v_page_size == 0) /* XXX */
+ vm_set_page_size();
+#endif
+
/*
* We round the size to an integer multiple.
*/
- size = (size + 3) &~ 3;
+ size = (size + 3) &~ 3; /* XXX */
/*
* If this is the first call to pmap_steal_memory,
View
4 sys/vm/vm_pageout.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_pageout.c 7.4 (Berkeley) 5/7/91
- * $Id: vm_pageout.c,v 1.10.2.2 1994/04/15 04:24:33 cgd Exp $
+ * $Id: vm_pageout.c,v 1.10.2.3 1994/04/15 06:28:09 cgd Exp $
*
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
@@ -210,7 +210,7 @@ vm_pageout_scan()
pmap_page_protect(VM_PAGE_TO_PHYS(m),
VM_PROT_NONE);
m->flags |= PG_BUSY;
- cnt.v_pgpgout++;
+ cnt.v_pageouts++;
/*
* Try to collapse the object before
View
25 sys/vm/vm_param.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_param.h 7.2 (Berkeley) 4/21/91
- * $Id: vm_param.h,v 1.4 1993/07/29 21:45:42 jtc Exp $
+ * $Id: vm_param.h,v 1.4.4.1 1994/04/15 06:28:10 cgd Exp $
*
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
@@ -87,6 +87,7 @@ typedef int boolean_t;
* The machine independent pages are refered to as PAGES. A page
* is some number of hardware pages, depending on the target machine.
*/
+#define DEFAULT_PAGE_SIZE 4096
/*
* All references to the size of a page should be done with PAGE_SIZE
@@ -94,8 +95,13 @@ typedef int boolean_t;
* we can easily make them constant if we so desire.
*/
-#define PAGE_SIZE page_size /* size of page in addressible units */
-#define PAGE_SHIFT page_shift /* number of bits to shift for pages */
+#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 */
+#ifdef KERNEL
+extern vm_size_t page_mask;
+extern int page_shift;
+#endif
/*
* Return values from the VM routines.
@@ -118,8 +124,8 @@ typedef int boolean_t;
*/
#ifdef KERNEL
-#define atop(x) (((unsigned)(x)) >> page_shift)
-#define ptoa(x) ((vm_offset_t)((x) << page_shift))
+#define atop(x) (((unsigned)(x)) >> PAGE_SHIFT)
+#define ptoa(x) ((vm_offset_t)((x) << PAGE_SHIFT))
#endif /* KERNEL */
/*
@@ -129,19 +135,14 @@ typedef int boolean_t;
*/
#ifdef KERNEL
-#define round_page(x) ((vm_offset_t)((((vm_offset_t)(x)) + page_mask) & ~page_mask))
-#define trunc_page(x) ((vm_offset_t)(((vm_offset_t)(x)) & ~page_mask))
+#define round_page(x) ((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) & ~PAGE_MASK))
+#define trunc_page(x) ((vm_offset_t)(((vm_offset_t)(x)) & ~PAGE_MASK))
#else /* KERNEL */
#define round_page(x) ((((vm_offset_t)(x) + (vm_page_size - 1)) / vm_page_size) * vm_page_size)
#define trunc_page(x) ((((vm_offset_t)(x)) / vm_page_size) * vm_page_size)
#endif /* KERNEL */
#ifdef KERNEL
-extern vm_size_t page_size; /* machine independent page size */
-extern vm_size_t page_mask; /* page_size - 1; mask for
- offset within page */
-extern int page_shift; /* shift to use for page size */
-
extern vm_size_t mem_size; /* size of physical memory (bytes) */
extern vm_offset_t first_addr; /* first physical page */
extern vm_offset_t last_addr; /* last physical page */
Please sign in to comment.
Something went wrong with that request. Please try again.