diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-08-22 21:03:57 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-08-22 21:03:57 +0000 |
commit | 687713179a0daf32013442a5e71b47859d8f8a73 (patch) | |
tree | f460349ce4693a43e33e9d37d94997c796fb4399 | |
parent | 06206e833b142d5f07df8d8348e6aaf605d25bb5 (diff) |
Implement pmap_steal_memory() if HAVE_PMAP_DIRECT; no change except for
faster uvm initialization.
-rw-r--r-- | sys/arch/hp300/include/pmap.h | 3 | ||||
-rw-r--r-- | sys/arch/m68k/m68k/pmap_motorola.c | 34 |
2 files changed, 35 insertions, 2 deletions
diff --git a/sys/arch/hp300/include/pmap.h b/sys/arch/hp300/include/pmap.h index 9f3fd2bcdaf..8ccf6b6bc35 100644 --- a/sys/arch/hp300/include/pmap.h +++ b/sys/arch/hp300/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.15 2006/07/09 19:41:23 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.16 2006/08/22 21:03:54 miod Exp $ */ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ @@ -9,6 +9,7 @@ #define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg)) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)va) #define __HAVE_PMAP_DIRECT +#define PMAP_STEAL_MEMORY #endif #ifdef _KERNEL diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c index e56c554cb58..a5e3be26ce3 100644 --- a/sys/arch/m68k/m68k/pmap_motorola.c +++ b/sys/arch/m68k/m68k/pmap_motorola.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.c,v 1.46 2006/06/24 13:22:15 miod Exp $ */ +/* $OpenBSD: pmap_motorola.c,v 1.47 2006/08/22 21:03:56 miod Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -338,6 +338,37 @@ pg_to_pvh(struct vm_page *pg) return &pg->mdpage.pvent; } +#ifdef PMAP_STEAL_MEMORY +vaddr_t +pmap_steal_memory(size, vstartp, vendp) + vsize_t size; + vaddr_t *vstartp, *vendp; +{ + vaddr_t va; + u_int npg; + + size = round_page(size); + npg = atop(size); + + /* m68k systems which define PMAP_STEAL_MEMORY only have one segment. */ +#ifdef DIAGNOSTIC + if (vm_physmem[0].avail_end - vm_physmem[0].avail_start < npg) + panic("pmap_steal_memory(%x): out of memory", size); +#endif + + va = ptoa(vm_physmem[0].avail_start); + vm_physmem[0].avail_start += npg; + vm_physmem[0].start += npg; + + if (vstartp != NULL) + *vstartp = virtual_avail; + if (vendp != NULL) + *vendp = virtual_end; + + bzero((void *)va, size); + return (va); +} +#else /* * pmap_virtual_space: [ INTERFACE ] * @@ -357,6 +388,7 @@ pmap_virtual_space(vstartp, vendp) *vstartp = virtual_avail; *vendp = virtual_end; } +#endif /* * pmap_init: [ INTERFACE ] |