kernel/eka/memmodel/epoc/flexible/mmu/mmu.h
branchRCL_3
changeset 87 2f92ad2dc5db
parent 0 a41df078684a
child 110 c734af59ce98
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmu.h	Mon Mar 15 12:45:50 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmu.h	Wed Mar 31 23:38:45 2010 +0300
@@ -86,7 +86,8 @@
 		Page is in an indeterminate state.
 
 		A page is placed into this state by Mmu::PagesAllocated when it is
-		allocated (ceases to be #EUnused). Once the page
+		allocated (ceases to be #EUnused). Once the page has been assigned to 
+		its new use its type will be updated.
 		*/
 		EUnknown,
 
@@ -222,7 +223,7 @@
 		{
 		/**
 		The memory object which owns this page.
-		Used for always set for #EManaged pages and can be set for #PhysAlloc pages.
+		Always set for #EManaged pages and can be set for #PhysAlloc pages.
 		*/
 		DMemoryObject* iOwner;
 
@@ -301,7 +302,7 @@
 	*/
 	FORCE_INLINE static SPageInfo* FromLink(SDblQueLink* aLink)
 		{
-		return (SPageInfo*)((TInt)aLink-_FOFF(SPageInfo,iLink));
+		return _LOFF(aLink, SPageInfo, iLink);
 		}
 
 	//
@@ -487,7 +488,7 @@
 		}
 
 	/**
-	Reutrns a pointer to the SPageInfo of the page that this page is shadowing.
+	Returns a pointer to the SPageInfo of the page that this page is shadowing.
 
 	@return	A pointer to the SPageInfo that this page is shadowing
 
@@ -574,7 +575,7 @@
 		}
 
 	/**
-	The the pages #iModifier value.
+	Set the page's #iModifier value.
 
 	#iModifier is cleared to zero whenever the usage or paging state of the page
 	changes. So if a thread sets this to a suitable unique value (e.g. the address
@@ -1435,7 +1436,7 @@
 	*/
 	FORCE_INLINE static SPageTableInfo* FromFreeLink(SDblQueLink* aLink)
 		{
-		return (SPageTableInfo*)((TInt)aLink-_FOFF(SPageTableInfo,iUnused));
+		return _LOFF(aLink, SPageTableInfo, iUnused);
 		}
 
 	/**
@@ -1712,9 +1713,9 @@
 	*/
 	static FORCE_INLINE void UnlockGuardStart()
 		{
-		#ifdef _DEBUG
-			++UnlockGuardNest;
-		#endif
+#ifdef _DEBUG
+		++UnlockGuardNest;
+#endif
 		}
 
 	/**
@@ -1723,18 +1724,18 @@
 
 	@see UnlockGuardStart
 
-	@return True if the MmuLock was released between a previous #UnlockGuardStart
+	@return EFalse if the MmuLock was released between a previous #UnlockGuardStart
 			and the call this function.
 	*/
 	static FORCE_INLINE TBool UnlockGuardEnd()
 		{
-		#ifdef _DEBUG
-			__NK_ASSERT_DEBUG(UnlockGuardNest);
-			--UnlockGuardNest;
-			return UnlockGuardFail==0;
-		#else
-			return true;
-		#endif
+#ifdef _DEBUG
+		__NK_ASSERT_DEBUG(UnlockGuardNest);
+		--UnlockGuardNest;
+		return UnlockGuardFail==0;
+#else
+		return ETrue;
+#endif
 		}
 
 private:
@@ -1744,10 +1745,10 @@
 	*/
 	static FORCE_INLINE void UnlockGuardCheck()
 		{
-		#ifdef _DEBUG
-			if(UnlockGuardNest)
-				UnlockGuardFail = true;
-		#endif
+#ifdef _DEBUG
+		if(UnlockGuardNest)
+			UnlockGuardFail = ETrue;
+#endif
 		}
 
 private:
@@ -1951,6 +1952,8 @@
 	void Init2FinalCommon();
 	void Init3();
 
+	void BTracePrime(TUint aCategory);
+
 	static void Panic(TPanic aPanic);
 
 	static TInt HandlePageFault(TLinAddr aPc, TLinAddr aFaultAddress, TUint aAccessPermissions, TAny* aExceptionInfo);
@@ -1979,7 +1982,11 @@
 	void FreePhysicalRam(TPhysAddr aPhysAddr, TUint aCount);
 	TInt ClaimPhysicalRam(TPhysAddr aPhysAddr, TUint aCount, TRamAllocFlags aFlags);
 	void AllocatedPhysicalRam(TPhysAddr aPhysAddr, TUint aCount, TRamAllocFlags aFlags);
+private:
+	void SetAllocPhysRam(TPhysAddr aPhysAddr, TUint aCount);
+	void SetAllocPhysRam(TPhysAddr* aPageList, TUint aNumPages);
 
+public:
 	TLinAddr MapTemp(TPhysAddr aPage, TUint aColour, TUint aSlot=0);
 	void UnmapTemp(TUint aSlot=0);
 	void RemoveAliasesForPageTable(TPhysAddr aPageTable);
@@ -2132,8 +2139,11 @@
 	TUint iRamAllocInitialFreePages;
 
 	friend class RamAllocLock;
+
+#ifdef FMM_VERIFY_RAM
 private:
 	void VerifyRam();
+#endif
 	};
 
 /**