summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_kern.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2010-04-18 22:32:07 +0000
committerjmallett <jmallett@FreeBSD.org>2010-04-18 22:32:07 +0000
commit4f9a815abecac01cf0fb2df739683c5cfb01c867 (patch)
treeda5df1cb44611f0607de0cedd81f3d7d10512466 /sys/vm/vm_kern.c
parent2c6900a254f8747c55019ef3c5fff96917c31b48 (diff)
downloadFreeBSD-src-4f9a815abecac01cf0fb2df739683c5cfb01c867.zip
FreeBSD-src-4f9a815abecac01cf0fb2df739683c5cfb01c867.tar.gz
o) Add a VM find-space option, VMFS_TLB_ALIGNED_SPACE, which searches the
address space for an address as aligned by the new pmap_align_tlb() function, which is for constraints imposed by the TLB. [1] o) Add a kmem_alloc_nofault_space() function, which acts like kmem_alloc_nofault() but allows the caller to specify which find-space option to use. [1] o) Use kmem_alloc_nofault_space() with VMFS_TLB_ALIGNED_SPACE to allocate the kernel stack address on MIPS. [1] o) Make pmap_align_tlb() on MIPS align addresses so that they do not start on an odd boundary within the TLB, so that they are suitable for insertion as wired entries and do not have to share a TLB entry with another mapping, assuming they are appropriately-sized. o) Eliminate md_realstack now that the kstack will be appropriately-aligned on MIPS. o) Increase the number of guard pages to 2 so that we retain the proper alignment of the kstack address. Reviewed by: [1] alc X-MFC-after: Making sure alc has not come up with a better interface.
Diffstat (limited to 'sys/vm/vm_kern.c')
-rw-r--r--sys/vm/vm_kern.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index 9006572..739d289 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -119,6 +119,35 @@ kmem_alloc_nofault(map, size)
}
/*
+ * kmem_alloc_nofault_space:
+ *
+ * Allocate a virtual address range with no underlying object and
+ * no initial mapping to physical memory within the specified
+ * address space. Any mapping from this range to physical memory
+ * must be explicitly created prior to its use, typically with
+ * pmap_qenter(). Any attempt to create a mapping on demand
+ * through vm_fault() will result in a panic.
+ */
+vm_offset_t
+kmem_alloc_nofault_space(map, size, find_space)
+ vm_map_t map;
+ vm_size_t size;
+ int find_space;
+{
+ vm_offset_t addr;
+ int result;
+
+ size = round_page(size);
+ addr = vm_map_min(map);
+ result = vm_map_find(map, NULL, 0, &addr, size, find_space,
+ VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
+ if (result != KERN_SUCCESS) {
+ return (0);
+ }
+ return (addr);
+}
+
+/*
* Allocate wired-down memory in the kernel's address map
* or a submap.
*/
OpenPOWER on IntegriCloud