I'm in the process of porting of dlmalloc to my kernel.
dlmalloc needs that one provide sbrk() function or mmap() and munmap() to operate correctly.
I decided to implement mmap() and munmap() but I want to be sure that I correctly understood how they work.
So, I think that it's like:
1. Allocate number of physical pages corresponding to length / PAGE_SIZE.void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
2. Find a suitable memory range in the virtual memory (heap)
3. Map each physical page address to a virtual address accordingly to provided protection flags (read, write, exec)
Am I right or did I forgot some steps?