diff options
-rw-r--r-- | sys/kern/vfs_bio.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_extern.h | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_init.c | 13 | ||||
-rw-r--r-- | sys/uvm/uvm_km.c | 29 | ||||
-rw-r--r-- | sys/uvm/uvm_km.h | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_param.h | 6 |
6 files changed, 33 insertions, 27 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index c7da9149991..5611c6be390 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.167 2015/01/18 14:01:54 miod Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.168 2015/02/07 08:21:24 miod Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /* @@ -179,7 +179,7 @@ bufinit(void) * space for mapping buffers. */ if (bufkvm == 0) - bufkvm = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 10; + bufkvm = VM_KERNEL_SPACE_SIZE / 10; /* * Don't use more than twice the amount of bufpages for mappings. diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index f6040aaf6fd..ddee989106b 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.130 2015/02/06 11:41:55 beck Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.131 2015/02/07 08:21:24 miod Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -262,6 +262,8 @@ extern struct vm_map *kernel_map; extern struct vm_map *kmem_map; extern struct vm_map *phys_map; +/* base of kernel virtual memory */ +extern vaddr_t vm_min_kernel_address; /* zalloc zeros memory, alloc does not */ #define uvm_km_zalloc(MAP,SIZE) uvm_km_alloc1(MAP,SIZE,0,TRUE) diff --git a/sys/uvm/uvm_init.c b/sys/uvm/uvm_init.c index f3628aade7b..9217a09b0e0 100644 --- a/sys/uvm/uvm_init.c +++ b/sys/uvm/uvm_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_init.c,v 1.37 2014/12/17 06:58:11 guenther Exp $ */ +/* $OpenBSD: uvm_init.c,v 1.38 2015/02/07 08:21:24 miod Exp $ */ /* $NetBSD: uvm_init.c,v 1.14 2000/06/27 17:29:23 mrg Exp $ */ /* @@ -53,6 +53,12 @@ struct uvm uvm; /* decl */ struct uvmexp uvmexp; /* decl */ +#if defined(VM_MIN_KERNEL_ADDRESS) +vaddr_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS; +#else +vaddr_t vm_min_kernel_address; +#endif + /* * local prototypes */ @@ -95,7 +101,7 @@ uvm_init(void) * kmem_object. */ - uvm_km_init(kvm_start, kvm_end); + uvm_km_init(vm_min_kernel_address, kvm_start, kvm_end); /* * step 4.5: init (tune) the fault recovery code. @@ -138,8 +144,7 @@ uvm_init(void) * the VM system is now up! now that malloc is up we can * enable paging of kernel objects. */ - uao_create(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS, - UAO_FLAG_KERNSWAP); + uao_create(VM_KERNEL_SPACE_SIZE, UAO_FLAG_KERNSWAP); /* * reserve some unmapped space for malloc/pool use after free usage diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index 9df0471b2e2..385a13374fa 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.125 2015/02/06 10:58:35 deraadt Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.126 2015/02/07 08:21:24 miod Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -70,8 +70,8 @@ * overview of kernel memory management: * * the kernel virtual address space is mapped by "kernel_map." kernel_map - * starts at VM_MIN_KERNEL_ADDRESS and goes to VM_MAX_KERNEL_ADDRESS. - * note that VM_MIN_KERNEL_ADDRESS is equal to vm_map_min(kernel_map). + * starts at a machine-dependent address and is VM_KERNEL_SPACE_SIZE bytes + * large. * * the kernel_map has several "submaps." submaps can only appear in * the kernel_map (user processes can't use them). submaps "take over" @@ -98,8 +98,8 @@ * reference count is set to UVM_OBJ_KERN (thus indicating that the objects * are "special" and never die). all kernel objects should be thought of * as large, fixed-sized, sparsely populated uvm_objects. each kernel - * object is equal to the size of kernel virtual address space (i.e. the - * value "VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS"). + * object is equal to the size of kernel virtual address space (i.e. + * VM_KERNEL_SPACE_SIZE). * * most kernel private memory lives in kernel_object. the only exception * to this is for memory that belongs to submaps that must be protected @@ -114,9 +114,9 @@ * offsets that are managed by the submap. * * note that the "offset" in a kernel object is always the kernel virtual - * address minus the VM_MIN_KERNEL_ADDRESS (aka vm_map_min(kernel_map)). + * address minus the vm_map_min(kernel_map). * example: - * suppose VM_MIN_KERNEL_ADDRESS is 0xf8000000 and the kernel does a + * suppose kernel_map starts at 0xf8000000 and the kernel does a * uvm_km_alloc(kernel_map, PAGE_SIZE) [allocate 1 wired down page in the * kernel map]. if uvm_km_alloc returns virtual address 0xf8235000, * then that means that the page at offset 0x235000 in kernel_object is @@ -152,21 +152,16 @@ static struct vm_map kernel_map_store; * uvm_km_init: init kernel maps and objects to reflect reality (i.e. * KVM already allocated for text, data, bss, and static data structures). * - * => KVM is defined by VM_MIN_KERNEL_ADDRESS/VM_MAX_KERNEL_ADDRESS. - * we assume that [min -> start] has already been allocated and that - * "end" is the end. + * => KVM is defined by [base.. base + VM_KERNEL_SPACE_SIZE]. + * we assume that [base -> start] has already been allocated and that + * "end" is the end of the kernel image span. */ void -uvm_km_init(vaddr_t start, vaddr_t end) +uvm_km_init(vaddr_t base, vaddr_t start, vaddr_t end) { - vaddr_t base = VM_MIN_KERNEL_ADDRESS; - - /* next, init kernel memory objects. */ - /* kernel_object: for pageable anonymous kernel memory */ uao_init(); - uvm.kernel_object = uao_create(VM_MAX_KERNEL_ADDRESS - - VM_MIN_KERNEL_ADDRESS, UAO_FLAG_KERNOBJ); + uvm.kernel_object = uao_create(VM_KERNEL_SPACE_SIZE, UAO_FLAG_KERNOBJ); /* * init the map and reserve already allocated kernel space diff --git a/sys/uvm/uvm_km.h b/sys/uvm/uvm_km.h index d889cbce13a..c851067a0e0 100644 --- a/sys/uvm/uvm_km.h +++ b/sys/uvm/uvm_km.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.h,v 1.13 2014/07/11 16:35:40 jsg Exp $ */ +/* $OpenBSD: uvm_km.h,v 1.14 2015/02/07 08:21:24 miod Exp $ */ /* $NetBSD: uvm_km.h,v 1.9 1999/06/21 17:25:11 thorpej Exp $ */ /* @@ -43,7 +43,7 @@ * prototypes */ -void uvm_km_init(vaddr_t, vaddr_t); +void uvm_km_init(vaddr_t, vaddr_t, vaddr_t); void uvm_km_page_init(void); void uvm_km_pgremove(struct uvm_object *, vaddr_t, vaddr_t); void uvm_km_pgremove_intrsafe(vaddr_t, vaddr_t); diff --git a/sys/uvm/uvm_param.h b/sys/uvm/uvm_param.h index f09fabc562c..d0fe8090eb1 100644 --- a/sys/uvm/uvm_param.h +++ b/sys/uvm/uvm_param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_param.h,v 1.17 2014/07/08 17:19:26 deraadt Exp $ */ +/* $OpenBSD: uvm_param.h,v 1.18 2015/02/07 08:21:24 miod Exp $ */ /* $NetBSD: uvm_param.h,v 1.5 2001/03/09 01:02:12 chs Exp $ */ /* @@ -83,5 +83,9 @@ typedef int boolean_t; #define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_page(x) ((x) & ~PAGE_MASK) +#if !defined(VM_KERNEL_SPACE_SIZE) +#define VM_KERNEL_SPACE_SIZE (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) +#endif + #endif /* _KERNEL */ #endif /* _VM_PARAM_ */ |