kernel/eka/memmodel/epoc/flexible/mmu/mmu.h
changeset 90 947f0dc9f7a8
parent 0 a41df078684a
child 102 ef2a444a7410
child 132 e4a7b1cbe40c
equal deleted inserted replaced
52:2d65c2f76d7b 90:947f0dc9f7a8
    19 */
    19 */
    20 
    20 
    21 #ifndef __MMU_H__
    21 #ifndef __MMU_H__
    22 #define __MMU_H__
    22 #define __MMU_H__
    23 
    23 
    24 #define _USE_OLDEST_LISTS
       
    25 
       
    26 #include "mm.h"
    24 #include "mm.h"
    27 #include "mmboot.h"
    25 #include "mmboot.h"
    28 #include <mmtypes.h>
    26 #include <mmtypes.h>
    29 #include <kern_priv.h>
    27 #include <kern_priv.h>
    30 
    28 
   143 	State for the page when being used to contain demand paged content.
   141 	State for the page when being used to contain demand paged content.
   144 	*/
   142 	*/
   145 	enum TPagedState
   143 	enum TPagedState
   146 		{
   144 		{
   147 		/**
   145 		/**
   148 		Page is not being managed for demand paging purposes, is has been transiently
   146 		Page is not being managed for demand paging purposes, or has been transiently
   149 		removed from the demand paging live list.
   147 		removed from the demand paging live list.
   150 		*/
   148 		*/
   151 		EUnpaged 			= 0x0,
   149 		EUnpaged 			= 0x0,
   152 
   150 
   153 		/**
   151 		/**
   169 		Page has been removed from live list to prevent contents being paged-out.
   167 		Page has been removed from live list to prevent contents being paged-out.
   170 		*/
   168 		*/
   171 		// NOTE - This must be the same value as EStatePagedLocked as defined in mmubase.h
   169 		// NOTE - This must be the same value as EStatePagedLocked as defined in mmubase.h
   172 		EPagedPinned 		= 0x4,
   170 		EPagedPinned 		= 0x4,
   173 
   171 
   174 #ifdef _USE_OLDEST_LISTS
       
   175 		/**
   172 		/**
   176 		Page is in the live list as one of oldest pages that is clean.
   173 		Page is in the live list as one of oldest pages that is clean.
   177 		*/
   174 		*/
   178 		EPagedOldestClean	= 0x5,
   175 		EPagedOldestClean	= 0x5,
   179 
   176 
   180 		/**
   177 		/**
   181 		Page is in the live list as one of oldest pages that is dirty.
   178 		Page is in the live list as one of oldest pages that is dirty.
   182 		*/
   179 		*/
   183 		EPagedOldestDirty 	= 0x6
   180 		EPagedOldestDirty 	= 0x6	
   184 #endif
       
   185 		};
   181 		};
   186 
   182 
   187 
   183 
   188 	/**
   184 	/**
   189 	Additional flags, stored in #iFlags2.
   185 	Additional flags, stored in #iFlags2.
   675 		return iFlags&EWritable;
   671 		return iFlags&EWritable;
   676 		}
   672 		}
   677 
   673 
   678 	/**
   674 	/**
   679 	Flag this page as 'dirty', indicating that its contents may no longer match those saved
   675 	Flag this page as 'dirty', indicating that its contents may no longer match those saved
   680 	to a backing store. This sets the flag #EWritable.
   676 	to a backing store. This sets the flag #EDirty.
   681 
   677 
   682 	This is used in the management of demand paged memory.
   678 	This is used in the management of demand paged memory.
   683 
   679 
   684 	@pre #MmuLock held.
   680 	@pre #MmuLock held.
   685 	*/
   681 	*/
   686 	FORCE_INLINE void SetDirty()
   682 	FORCE_INLINE void SetDirty()
   687 		{
   683 		{
   688 		CheckAccess("SetDirty");
   684 		CheckAccess("SetDirty");
       
   685 		__NK_ASSERT_DEBUG(IsWritable());
   689 		iFlags |= EDirty;
   686 		iFlags |= EDirty;
   690 		}
   687 		}
   691 
   688 
   692 	/**
   689 	/**
   693 	Flag this page as 'clean', indicating that its contents now match those saved
   690 	Flag this page as 'clean', indicating that its contents now match those saved
   694 	to a backing store. This clears the flag #EWritable.
   691 	to a backing store. This clears the flag #EDirty.
   695 
   692 
   696 	This is used in the management of demand paged memory.
   693 	This is used in the management of demand paged memory.
   697 
   694 
   698 	@pre #MmuLock held.
   695 	@pre #MmuLock held.
   699 	*/
   696 	*/
   700 	FORCE_INLINE void SetClean()
   697 	FORCE_INLINE void SetClean()
   701 		{
   698 		{
   702 		CheckAccess("SetClean");
   699 		CheckAccess("SetClean");
       
   700 		__NK_ASSERT_DEBUG(!IsWritable());
   703 		iFlags &= ~EDirty;
   701 		iFlags &= ~EDirty;
   704 		}
   702 		}
   705 
   703 
   706 	/**
   704 	/**
   707 	Return the  #EDirty flag. See #SetDirty and #SetClean.
   705 	Return the  #EDirty flag. See #SetDirty and #SetClean.
  1748 			if(UnlockGuardNest)
  1746 			if(UnlockGuardNest)
  1749 				UnlockGuardFail = true;
  1747 				UnlockGuardFail = true;
  1750 		#endif
  1748 		#endif
  1751 		}
  1749 		}
  1752 
  1750 
  1753 private:
  1751 public:
  1754 	/** The lock */
  1752 	/** The lock */
  1755 	static NFastMutex iLock;
  1753 	static NFastMutex iLock;
  1756 
  1754 
  1757 #ifdef _DEBUG
  1755 #ifdef _DEBUG
       
  1756 private:
  1758 	static TUint UnlockGuardNest;
  1757 	static TUint UnlockGuardNest;
  1759 	static TUint UnlockGuardFail;
  1758 	static TUint UnlockGuardFail;
  1760 #endif
  1759 #endif
  1761 	};
  1760 	};
  1762 
  1761