kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp
branchGCC_SURGE
changeset 167 b41fc9c39ca7
parent 102 ef2a444a7410
child 221 39b39e1a406e
equal deleted inserted replaced
166:d7c1885c0106 167:b41fc9c39ca7
   394 	aZone->iAllocPages[aType] += aCount;
   394 	aZone->iAllocPages[aType] += aCount;
   395 	aZone->iFreePages -= aCount;
   395 	aZone->iFreePages -= aCount;
   396 	aZone->iFlags &= ~KRamZoneFlagMark;	// clear the mark as this zone is active
   396 	aZone->iFlags &= ~KRamZoneFlagMark;	// clear the mark as this zone is active
   397 
   397 
   398 	// Check if power state of zone needs to be changed
   398 	// Check if power state of zone needs to be changed
   399 	if (iZonePowerFunc && !(iZonePwrState & (((TUint64)1) << aZone - iZones)))
   399 	if (iZonePowerFunc && !(iZonePwrState & (((TUint64)1) << (aZone - iZones))))
   400 		{//zone no longer empty so call variant to power RAM zone up if necessary
   400 		{//zone no longer empty so call variant to power RAM zone up if necessary
   401 		iZonePwrState |= (((TUint64)1) << aZone - iZones);
   401 		iZonePwrState |= (((TUint64)1) << (aZone - iZones));
   402 
   402 
   403 		if (iZoneCallbackInitSent)
   403 		if (iZoneCallbackInitSent)
   404 			{
   404 			{
   405 			TInt ret = (*iZonePowerFunc)(ERamZoneOp_PowerUp, (TAny*)aZone->iId, (TUint*)&iZonePwrState);
   405 			TInt ret = (*iZonePowerFunc)(ERamZoneOp_PowerUp, (TAny*)aZone->iId, (TUint*)&iZonePwrState);
   406 			if (ret != KErrNone && ret != KErrNotSupported)
   406 			if (ret != KErrNone && ret != KErrNotSupported)
   539 	//	Don't update iZonePwrState when a zone is being cleared to then be 
   539 	//	Don't update iZonePwrState when a zone is being cleared to then be 
   540 	//	claimed as it shouldn't be powered off as it's about to be used.
   540 	//	claimed as it shouldn't be powered off as it's about to be used.
   541 	if (iZonePowerFunc && !(aZone->iFlags & KRamZoneFlagClaiming) &&
   541 	if (iZonePowerFunc && !(aZone->iFlags & KRamZoneFlagClaiming) &&
   542 		aZone->iFreePages == aZone->iPhysPages)
   542 		aZone->iFreePages == aZone->iPhysPages)
   543 		{// Zone is empty so call variant to power down RAM zone if desirable.
   543 		{// Zone is empty so call variant to power down RAM zone if desirable.
   544 		TUint64 pwrMask = ~(((TUint64)1) << aZone - iZones);
   544 		TUint64 pwrMask = ~(((TUint64)1) << (aZone - iZones));
   545 		iZonePwrState &= pwrMask;
   545 		iZonePwrState &= pwrMask;
   546 
   546 
   547 		// Don't invoke callback until Init callback sent.
   547 		// Don't invoke callback until Init callback sent.
   548 		if (iZoneCallbackInitSent)
   548 		if (iZoneCallbackInitSent)
   549 			{
   549 			{
  1007 		// Find how many zones that have a lower preference than this one
  1007 		// Find how many zones that have a lower preference than this one
  1008 		const SZone* zone2 = iZones;
  1008 		const SZone* zone2 = iZones;
  1009 		for (; zone2 < lastZone; zone2++)
  1009 		for (; zone2 < lastZone; zone2++)
  1010 			{
  1010 			{
  1011 			if (zone->iPref > zone2->iPref ||
  1011 			if (zone->iPref > zone2->iPref ||
  1012 				zone->iPref == zone2->iPref && zone->iFreePages > zone2->iFreePages)
  1012 				(zone->iPref == zone2->iPref && zone->iFreePages > zone2->iFreePages))
  1013 				{
  1013 				{
  1014 				lowerZones++;
  1014 				lowerZones++;
  1015 				}
  1015 				}
  1016 			}
  1016 			}
  1017 		while (prefOrder[lowerZones] != 0)
  1017 		while (prefOrder[lowerZones] != 0)