diff options
author | Ian Moffett <ian@osmora.org> | 2024-04-16 20:21:16 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-04-16 20:21:16 -0400 |
commit | 145bbb28313dd2ecb166946351c098f3118789e4 (patch) | |
tree | 8cf0509354b1565687889f8a719011646ceb134c /sys/vm | |
parent | b287dd77d65fa197079d885b141b60476c63cd7a (diff) |
kernel: vm_map: Allocate physmem for MAP_ANONYMOUS
Only allocate physical memory during an anonymous map request
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 266d696..49d1149 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -187,11 +187,6 @@ mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off) /* Invalid prot */ return MAP_FAILED; - /* Allocate the physical memory */ - physmem = vm_alloc_pageframe(len / GRANULE); - if (physmem == 0) - return MAP_FAILED; - /* * Handle address being NULL. * @@ -204,6 +199,11 @@ mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off) /* Handle an anonymous map request */ if (__TEST(flags, MAP_ANONYMOUS)) { + /* Allocate the physical memory */ + physmem = vm_alloc_pageframe(len / GRANULE); + if (physmem == 0) + return MAP_FAILED; + /* * XXX: There is no need to worry about alignment yet * as vm_map_create() handles that internally. |