diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-01-07 05:31:28 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-01-07 05:31:28 +0000 |
commit | 3ba3101e89396fbd0c670f1eb63fb88c72f710a7 (patch) | |
tree | 97ecb3bf68f597d7709a8d18cda30687d7493450 | |
parent | b57f9f5ef5ecb674dac71b5b6c6158a029e4c77c (diff) |
Paranoia on my part, do not let the condition exist where kvm space could
be claimed by the pre kvm init stealing process and kvm.
-rw-r--r-- | sys/arch/macppc/include/vmparam.h | 7 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 13 |
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/arch/macppc/include/vmparam.h b/sys/arch/macppc/include/vmparam.h index 9a946263338..1460bce56d6 100644 --- a/sys/arch/macppc/include/vmparam.h +++ b/sys/arch/macppc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.6 2001/12/05 16:25:44 art Exp $ */ +/* $OpenBSD: vmparam.h,v 1.7 2002/01/07 05:31:27 drahn Exp $ */ /* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ /*- @@ -93,10 +93,9 @@ * initialized. */ #define VM_KERN_ADDR_SIZE_DEF SEGMENT_LENGTH -extern vm_offset_t ppc_kvm_size; -#define VM_KERN_ADDRESS_SIZE (ppc_kvm_size) +#define VM_KERN_ADDRESS_SIZE (SEGMENT_LENGTH - (32 * 1024 * 1024)) #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)((KERNEL_SR << ADDR_SR_SHFT) \ - + SEGMENT_LENGTH)) + + VM_KERN_ADDRESS_SIZE)) #define VM_MBUF_SIZE (NMBCLUSTERS * PAGE_SIZE) #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index dfc242a6df7..88dc551b143 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.18 2001/12/08 02:24:06 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.19 2002/01/07 05:31:27 drahn Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -1158,10 +1158,10 @@ bus_space_unmap(t, bsh, size) off = bsh - sva; len = size+off; + /* do not free memory which was stolen from the vm system */ if (ppc_malloc_ok && ((sva >= VM_MIN_KERNEL_ADDRESS) && (sva < VM_MAX_KERNEL_ADDRESS)) ) { - /* do not free memory which was stolen from the vm system */ uvm_km_free(phys_map, sva, len); } #if 0 @@ -1178,6 +1178,8 @@ bus_space_unmap(t, bsh, size) pmap_update(pmap_kernel()); } +vm_offset_t ppc_kvm_stolen = VM_KERN_ADDRESS_SIZE; + int bus_mem_add_mapping(bpa, size, cacheable, bshp) bus_addr_t bpa; @@ -1205,9 +1207,12 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) /* need to steal vm space before kernel vm is initialized */ alloc_size = round_page(size); - ppc_kvm_size -= alloc_size; - vaddr = VM_MIN_KERNEL_ADDRESS + ppc_kvm_size; + vaddr = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen; + ppc_kvm_stolen += alloc_size; + if (ppc_kvm_stolen > SEGMENT_LENGTH) { + panic("ppc_kvm_stolen, out of space"); + } } else { vaddr = uvm_km_valloc_wait(phys_map, len); } |