3 ms·
If you had a way of allocating pages of at least N bytes it would work. uint8_t* mem = malloc_pages(1024); mprotect_paged(mem, 1024);
by IshKebab 2y ago
If you had a way of allocating pages of at least N bytes it would work.
uint8_t* mem = malloc_pages(1024);
mprotect_paged(mem, 1024);
- fweimer 2y agoThat's how mmap and mprotect work today. Sizes get rounded up to the next multiple of the page size. Many applications using mmap do not need to know about the page size. I think it's even part of POSIX: “The system performs mapping operations over whole pages. Thus, while the parameter len need not meet a size or alignment constraint, the system shall include, in any mapping operation, any partial page specified by the address range starting at pa and continuing for len bytes.”