From 24e25d11c0460dfb39fade685375c0e58cbcb40e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Mon, 26 Jun 2006 10:18:28 +0000 Subject: =?UTF-8?q?=E2=80=A2=09BaseMemoryLib:=20=09Modify=20some=20Aassert?= =?UTF-8?q?()s=20conditions=20to=20sync=20with=20MWG=200.56d=20=09Modify?= =?UTF-8?q?=20some=20defects=20in=20function=20header.=20=E2=80=A2=09PostC?= =?UTF-8?q?odeLib:=20Implement=20PeiDxePostCodeLibReportStatusCode.=20?= =?UTF-8?q?=E2=80=A2=09Misc=20Rename=20BaseDebugLibReportStatusCode=20to?= =?UTF-8?q?=20PeiDxeDebugLibReportStatusCode=20=09Remove=20tabs=20in=20all?= =?UTF-8?q?=20.c=20and=20.h=20files=20in=20MdePkg.=20=09Rename=20PeiServic?= =?UTF-8?q?esReinstallPpi()=20to=20PeiServicesReInstallPpi()=20=09Adjust?= =?UTF-8?q?=20some=20minor=20coding=20style=20in=20PeCoffLoaderGetEntryPoi?= =?UTF-8?q?nterLib()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@626 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c | 48 +++++++++++------------ 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c') diff --git a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c index 5ca62f5047..1fd00acabd 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c @@ -26,41 +26,37 @@ #include "MemLibInternals.h" /** - Copy Length bytes from Source to Destination. + Copies a source buffer to a destination buffer, and returns the destination buffer. - This function copies Length bytes from SourceBuffer to DestinationBuffer, and - returns DestinationBuffer. The implementation must be reentrant, and it must - handle the case where SourceBuffer overlaps DestinationBuffer. + This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns + DestinationBuffer. The implementation must be reentrant, and it must handle the case + where SourceBuffer overlaps DestinationBuffer. + If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then - ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). + @param DestinationBuffer Pointer to the destination buffer of the memory copy. + @param SourceBuffer Pointer to the source buffer of the memory copy. + @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer. - @param Destination Target of copy - @param Source Place to copy from - @param Length Number of bytes to copy - - @return Destination + @return DestinationBuffer. **/ VOID * EFIAPI CopyMem ( - OUT VOID *Destination, - IN CONST VOID *Source, - IN UINTN Length + OUT VOID *DestinationBuffer, + IN CONST VOID *SourceBuffer, + IN UINTN Length ) { - ASSERT ( - Destination == NULL || - Length <= MAX_ADDRESS - (UINTN)Destination + 1 - ); - ASSERT ( - Source == NULL || - Length <= MAX_ADDRESS - (UINTN)Source + 1 - ); - if (Destination == Source || Length == 0) { - return Destination; + if (Length == 0) { + return DestinationBuffer; + } + ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); + ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); + + if (DestinationBuffer == SourceBuffer) { + return DestinationBuffer; } - return InternalMemCopyMem (Destination, Source, Length); + return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length); } -- cgit v1.2.3