diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-05-01 02:25:37 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-05-01 02:25:37 +0200 |
commit | ded813a44263103a28e1788489ec0fef7e8d1c7e (patch) | |
tree | 77bc52c178b5eebe2b718e602e9152c1474a47bd /linux | |
parent | 0cf03cdab38bd588390ddecc7086d8bb0f56d71f (diff) | |
download | gnumach-ded813a44263103a28e1788489ec0fef7e8d1c7e.tar.gz gnumach-ded813a44263103a28e1788489ec0fef7e8d1c7e.tar.bz2 gnumach-ded813a44263103a28e1788489ec0fef7e8d1c7e.zip |
Add kmem_valloc
Functions like vremap need to allocate some virtual addressing space
before making their own mapping. kmem_alloc_wired can be used for that
but that wastes memory.
* vm/vm_kern.c (kmem_valloc): New function.
* vm/vm_kern.h (kmem_valloc): New prototype.
* linux/dev/glue/kmem.c (vremap): Call kmem_valloc instead of
kmem_alloc_wired. Also check that `offset' is aligned on a page.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/dev/glue/kmem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/linux/dev/glue/kmem.c b/linux/dev/glue/kmem.c index 8e0b5425..509229d1 100644 --- a/linux/dev/glue/kmem.c +++ b/linux/dev/glue/kmem.c @@ -574,8 +574,10 @@ vremap (unsigned long offset, unsigned long size) { vm_offset_t addr; kern_return_t ret; + + assert(page_aligned(offset)); - ret = kmem_alloc_wired (kernel_map, &addr, round_page (size)); + ret = kmem_valloc (kernel_map, &addr, round_page (size)); if (ret != KERN_SUCCESS) return NULL; |