diff options
author | Richard Braun <rbraun@sceen.net> | 2014-12-10 21:44:55 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-12-10 23:16:47 +0100 |
commit | 81a68dcbf0ecb02fa3b4e18a33788cdb5e857e34 (patch) | |
tree | 823525f0d32e419380830b707e89b78cfaceb1ba /vm | |
parent | db7bdca10749be2272f9d9cfb3251aa39b7d060e (diff) |
vm/vm_kmem: directmap update
Now that a direct physical mapping is available, memory can be allocated
out of it without the need of an early virtual memory allocator.
Diffstat (limited to 'vm')
-rw-r--r-- | vm/vm_kmem.c | 48 | ||||
-rw-r--r-- | vm/vm_kmem.h | 22 | ||||
-rw-r--r-- | vm/vm_setup.c | 2 |
3 files changed, 3 insertions, 69 deletions
diff --git a/vm/vm_kmem.c b/vm/vm_kmem.c index 9f1d4a25..5f756e72 100644 --- a/vm/vm_kmem.c +++ b/vm/vm_kmem.c @@ -36,52 +36,6 @@ static struct vm_map kernel_map_store; struct vm_map *kernel_map __read_mostly = &kernel_map_store; -/* - * Heap boundaries during bootstrap. - */ -static unsigned long vm_kmem_boot_start __initdata; -static unsigned long vm_kmem_boot_end __initdata; - -void __init -vm_kmem_setup(void) -{ - vm_kmem_boot_start = VM_MIN_KERNEL_ADDRESS; - vm_kmem_boot_end = VM_MAX_KERNEL_ADDRESS; -} - -void * __init -vm_kmem_bootalloc(size_t size) -{ - unsigned long start, va; - phys_addr_t pa; - - assert(size > 0); - - size = vm_page_round(size); - - if ((vm_kmem_boot_end - vm_kmem_boot_start) < size) - panic("vm_kmem: no virtual space available"); - - start = vm_kmem_boot_start; - vm_kmem_boot_start += size; - - for (va = start; va < vm_kmem_boot_start; va += PAGE_SIZE) { - pa = vm_page_bootalloc(); - pmap_enter(kernel_pmap, va, pa, VM_PROT_READ | VM_PROT_WRITE, - PMAP_PEF_GLOBAL); - } - - pmap_update(kernel_pmap); - return (void *)start; -} - -void __init -vm_kmem_boot_space(unsigned long *startp, unsigned long *endp) -{ - *startp = VM_MIN_KERNEL_ADDRESS; - *endp = vm_kmem_boot_start; -} - struct vm_page * vm_kmem_lookup_page(const void *addr) { @@ -156,7 +110,7 @@ vm_kmem_alloc(size_t size) return 0; for (start = va, end = va + size; start < end; start += PAGE_SIZE) { - page = vm_page_alloc(0, VM_PAGE_KMEM); + page = vm_page_alloc(0, VM_PAGE_SEL_HIGHMEM, VM_PAGE_KERNEL); if (page == NULL) goto error_page; diff --git a/vm/vm_kmem.h b/vm/vm_kmem.h index de66362a..ba3c10ca 100644 --- a/vm/vm_kmem.h +++ b/vm/vm_kmem.h @@ -24,9 +24,9 @@ * The kernel space is required not to start at address 0, which is used to * report allocation errors. */ -#if VM_MIN_KERNEL_ADDRESS == 0 +#if VM_MIN_KMEM_ADDRESS == 0 #error "kernel space must not start at address 0" -#endif +#endif /* VM_MIN_KMEM_ADDRESS == 0 */ /* * Special kernel addresses. @@ -42,24 +42,6 @@ extern char _end; extern struct vm_map *kernel_map; /* - * Initialize the vm_kmem module. - */ -void vm_kmem_setup(void); - -/* - * Early kernel memory allocator. - * - * The main purpose of this function is to allow the allocation of the - * physical page table. - */ -void * vm_kmem_bootalloc(size_t size); - -/* - * Return the range of initial virtual memory used by the kernel. - */ -void vm_kmem_boot_space(unsigned long *startp, unsigned long *endp); - -/* * Return the page descriptor for the physical page mapped at va in kernel * space. The given address must be mapped and valid. */ diff --git a/vm/vm_setup.c b/vm/vm_setup.c index f190c79a..092f8151 100644 --- a/vm/vm_setup.c +++ b/vm/vm_setup.c @@ -20,14 +20,12 @@ #include <kern/percpu.h> #include <machine/pmap.h> #include <vm/vm_map.h> -#include <vm/vm_kmem.h> #include <vm/vm_page.h> #include <vm/vm_setup.h> void __init vm_setup(void) { - vm_kmem_setup(); vm_page_setup(); kmem_setup(); vm_map_setup(); |