Modules/Tegra2Vid - Misc
[tpg/acess2.git] / KernelLand / Kernel / vfs / mmap.c
index 3539f37..b6d5c2d 100644 (file)
@@ -25,6 +25,7 @@ struct sVFS_MMapPageBlock
 // === 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)
@@ -70,7 +71,7 @@ void *VFS_MMap(void *DestHint, size_t Length, int Protection, int Flags, int FD,
        // - 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
                )
                ;
@@ -97,6 +98,8 @@ void *VFS_MMap(void *DestHint, size_t Length, int Protection, int Flags, int FD,
        // - 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 )

UCC git Repository :: git.ucc.asn.au