mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 07:04:28 +02:00
MdeModulePkg DxeCore: Add lock to pretect memory profile AllocInfo list
Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
1d60fe9642
commit
c16b7fe71a
@ -63,6 +63,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mMemoryProfileContext
|
|||||||
};
|
};
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA *mMemoryProfileContextPtr = NULL;
|
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA *mMemoryProfileContextPtr = NULL;
|
||||||
|
|
||||||
|
EFI_LOCK mMemoryProfileLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
|
||||||
BOOLEAN mMemoryProfileGettingStatus = FALSE;
|
BOOLEAN mMemoryProfileGettingStatus = FALSE;
|
||||||
BOOLEAN mMemoryProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE;
|
BOOLEAN mMemoryProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *mMemoryProfileDriverPath;
|
EFI_DEVICE_PATH_PROTOCOL *mMemoryProfileDriverPath;
|
||||||
@ -217,6 +218,28 @@ EDKII_MEMORY_PROFILE_PROTOCOL mProfileProtocol = {
|
|||||||
ProfileProtocolRecord,
|
ProfileProtocolRecord,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Acquire lock on mMemoryProfileLock.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
CoreAcquireMemoryProfileLock (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CoreAcquireLock (&mMemoryProfileLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Release lock on mMemoryProfileLock.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
CoreReleaseMemoryProfileLock (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CoreReleaseLock (&mMemoryProfileLock);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return memory profile context.
|
Return memory profile context.
|
||||||
|
|
||||||
@ -1383,6 +1406,7 @@ CoreUpdateProfile (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoreAcquireMemoryProfileLock ();
|
||||||
switch (BasicAction) {
|
switch (BasicAction) {
|
||||||
case MemoryProfileActionAllocatePages:
|
case MemoryProfileActionAllocatePages:
|
||||||
Status = CoreUpdateProfileAllocate (CallerAddress, Action, MemoryType, Size, Buffer, ActionString);
|
Status = CoreUpdateProfileAllocate (CallerAddress, Action, MemoryType, Size, Buffer, ActionString);
|
||||||
@ -1401,6 +1425,8 @@ CoreUpdateProfile (
|
|||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CoreReleaseMemoryProfileLock ();
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user