diff --git a/kernel/src/sys/mem.cpp b/kernel/src/sys/mem.cpp index 0950b6ad..1d046d00 100644 --- a/kernel/src/sys/mem.cpp +++ b/kernel/src/sys/mem.cpp @@ -7,6 +7,8 @@ #include "memory/VMM.h" #include +// FIXME: Round size up instead of down. (use get_blocks_from_size) + #define MAP_FAIL(errno) 0xffffffffffffff00 | (unsigned char)(errno) void sys_mmap(Context* context, void* address, size_t size, int flags) diff --git a/libs/libc/include/sys/mman.h b/libs/libc/include/sys/mman.h index ed7d4173..91e01264 100644 --- a/libs/libc/include/sys/mman.h +++ b/libs/libc/include/sys/mman.h @@ -5,6 +5,7 @@ typedef unsigned long off_t; +/* Address returned by mmap when it fails. */ #define MAP_FAILED (void*)-1 #define PROT_READ_WRITE 1 @@ -16,8 +17,12 @@ extern "C" { #endif - void* mmap(void*, size_t, int, int, int, off_t); - int munmap(void* addr, size_t len); + /* Maps size bytes of memory (rounded down to the nearest page-aligned size) into the current process's address + * space at addr. If addr is null, the kernel will choose an address. */ + void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset); + /* Unmaps size bytes of memory (rounded down to the nearest page-aligned size) at addr from the current process's + * address space. */ + int munmap(void* addr, size_t size); #ifdef __cplusplus }