// === PROTOTYPES ===
//void *VFS_MMap(void *DestHint, size_t Length, int Protection, int Flags, int FD, Uint64 Offset);
void *VFS_MMap_Anon(void *Destination, size_t Length, Uint FlagsSet, Uint FlagsMask);
+//int VFS_MUnmap(void *Addr, size_t Length);
// === CODE ===
void *VFS_MMap(void *DestHint, size_t Length, int Protection, int Flags, int FD, Uint64 Offset)
// - Sorted list of 16 page blocks
for(
pb = h->Node->MMapInfo, prev = NULL;
- pb && pb->BaseOffset + MMAP_PAGES_PER_BLOCK < pagenum;
+ pb && pb->BaseOffset + MMAP_PAGES_PER_BLOCK <= pagenum;
prev = pb, pb = pb->Next
)
;
// - Map (and allocate) pages
while( npages -- )
{
+ assert( pagenum >= pb->BaseOffset );
+ assert( pagenum - pb->BaseOffset < MMAP_PAGES_PER_BLOCK );
if( MM_GetPhysAddr( mapping_dest ) == 0 )
{
if( pb->PhysAddrs[pagenum - pb->BaseOffset] == 0 )