extern void gKernelEnd;
// === PROTOTYPES ===
-tPAddr MM_AllocPhys(void);
-tPAddr MM_AllocPhysRange(int Pages, int MaxBits);
-void MM_RefPhys(tPAddr PAddr);
-void MM_DerefPhys(tPAddr PAddr);
+void MM_Install(tMBoot_Info *MBoot);
+//tPAddr MM_AllocPhys(void);
+//tPAddr MM_AllocPhysRange(int Pages, int MaxBits);
+//void MM_RefPhys(tPAddr PAddr);
+//void MM_DerefPhys(tPAddr PAddr);
+// int MM_GetRefCount(tPAddr PAddr);
// === GLOBALS ===
tMutex glPhysAlloc;
Panic("The fuck? Too many pages! (indx = 0x%x)", indx);
}
+ if( indx >= giPageCount ) {
+ Mutex_Release( &glPhysAlloc );
+ Log_Error("PMem", "MM_AllocPhys - indx(%i) > giPageCount(%i)", indx, giPageCount);
+ LEAVE('i', 0);
+ return 0;
+ }
+
// Mark page used
if(gaPageReferences)
gaPageReferences[ indx ] = 1;
/**
* \fn int MM_GetRefCount(tPAddr Addr)
*/
-int MM_GetRefCount(tPAddr Addr)
+int MM_GetRefCount(tPAddr PAddr)
{
// Get page number
- Addr >>= 12;
+ PAddr >>= 12;
// We don't care about non-ram pages
- if(Addr >= giPageCount) return -1;
+ if(PAddr >= giPageCount) return -1;
// Check if it is freed
- return gaPageReferences[ Addr ];
+ return gaPageReferences[ PAddr ];
}