kernel/eka/memmodel/epoc/flexible/mmu/arm/xmmu.cpp
branchRCL_3
changeset 80 597aaf25e343
parent 62 4a8fed1c0ef6
child 256 c1f20ce4abcf
equal deleted inserted replaced
62:4a8fed1c0ef6 80:597aaf25e343
   926 		}
   926 		}
   927 
   927 
   928 	// Now we have the os asid check access to kernel memory.
   928 	// Now we have the os asid check access to kernel memory.
   929 	if(aAddr >= KUserMemoryLimit && osAsid != (TUint)KKernelOsAsid)
   929 	if(aAddr >= KUserMemoryLimit && osAsid != (TUint)KKernelOsAsid)
   930 		{
   930 		{
   931 		NKern::ThreadEnterCS();
       
   932 		MmuLock::Unlock();
       
   933 		if (!iAliasLinAddr)
   931 		if (!iAliasLinAddr)
   934 			{// Close the new reference as RemoveAlias won't do as iAliasLinAddr is not set.
   932 			{// Close the new reference as RemoveAlias won't do as iAliasLinAddr is not set.
   935 			aProcess->AsyncCloseOsAsid();	// Asynchronous close as this method should be quick.
   933 			aProcess->AsyncCloseOsAsid();	// Asynchronous close as this method should be quick.
   936 			}
   934 			}
   937 		NKern::ThreadLeaveCS();
   935 		MmuLock::Unlock();
   938 		return KErrBadDescriptor; // prevent access to supervisor only memory
   936 		return KErrBadDescriptor; // prevent access to supervisor only memory
   939 		}
   937 		}
   940 
   938 
   941 	// Now we know all accesses to global memory are safe so check if aAddr is global.
   939 	// Now we know all accesses to global memory are safe so check if aAddr is global.
   942 	if(aAddr >= KGlobalMemoryBase)
   940 	if(aAddr >= KGlobalMemoryBase)
   943 		{
   941 		{
   944 		// address is in global section, don't bother aliasing it...
   942 		// address is in global section, don't bother aliasing it...
   945 		if (!iAliasLinAddr)
   943 		if (!iAliasLinAddr)
   946 			{// Close the new reference as not required.
   944 			{// Close the new reference as not required.
   947 			NKern::ThreadEnterCS();
   945 			aProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
   948 			MmuLock::Unlock();
   946 			MmuLock::Unlock();
   949 			aProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
       
   950 			NKern::ThreadLeaveCS();
       
   951 			}
   947 			}
   952 		else
   948 		else
   953 			{// Remove the existing alias as it is not required.
   949 			{// Remove the existing alias as it is not required.
   954 			DoRemoveAlias(iAliasLinAddr);	// Releases mmulock.
   950 			DoRemoveAlias(iAliasLinAddr);	// Releases mmulock.
   955 			}
   951 			}
  1059 	__NK_ASSERT_DEBUG(iCpuRestoreCookie>=0);
  1055 	__NK_ASSERT_DEBUG(iCpuRestoreCookie>=0);
  1060 	NKern::EndFreezeCpu(iCpuRestoreCookie);
  1056 	NKern::EndFreezeCpu(iCpuRestoreCookie);
  1061 	iCpuRestoreCookie = -1;
  1057 	iCpuRestoreCookie = -1;
  1062 #endif
  1058 #endif
  1063 
  1059 
  1064 	// Must close the os asid while in critical section to prevent it being 
  1060 	// Must close the os asid while holding MmuLock so we are in an implicit critical section.
  1065 	// leaked.  However, we can't hold the mmu lock so we have to enter an 
  1061 	iAliasProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
  1066 	// explict crtical section. It is ok to release the mmu lock as the 
       
  1067 	// iAliasLinAddr and iAliasProcess members are only ever updated by the 
       
  1068 	// current thread.
       
  1069 	NKern::ThreadEnterCS();
       
  1070 	MmuLock::Unlock();
  1062 	MmuLock::Unlock();
  1071 	iAliasProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
       
  1072 	NKern::ThreadLeaveCS();
       
  1073 	}
  1063 	}
  1074 
  1064 
  1075 
  1065 
  1076 TInt M::DemandPagingFault(TAny* aExceptionInfo)
  1066 TInt M::DemandPagingFault(TAny* aExceptionInfo)
  1077 	{
  1067 	{