In preparation for Fuchsia support, this CL refactors the memory
mapping functions.
The new functions are as follows:
- for Freeslots and Metadata: void *map(size_t Size, const char *Name) const; void unmap(void *Ptr, size_t Size) const;
- for the Pool: void *reservePool(size_t Size); void commitPool(void *Ptr, size_t Size) const; void decommitPool(void *Ptr, size_t Size) const; void unreservePool(); Note that those don't need a Name parameter as those are fixed per function. {reserve,unreserve}Pool are not const because they will modify platform specific class member on Fuchsia.
I added a plethora of assert() as the initial code was not enforcing
page alignment for sizes and addresses, which caused problem in the
initial Fuchsia draft. All sizes should now be properly rounded up to
a page.
nits just to be really clear/descriptive with the function names.
mapWithRW()
reserveGuardedPool()
commitGuardedPoolRegionWithRW()
decommitGuardedPoolRegion()
unreserveGuardedPool()
Also can you add a comment above why the pool is special? Something like: