summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-26 10:18:28 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-26 10:18:28 +0000
commit24e25d11c0460dfb39fade685375c0e58cbcb40e (patch)
treea3e931c8113a9184433b347bacff079df18acac9 /MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
parent23f52b03b4202e4dc5af440a90f0b0864a45dbdd (diff)
downloadedk2-24e25d11c0460dfb39fade685375c0e58cbcb40e.tar.gz
edk2-24e25d11c0460dfb39fade685375c0e58cbcb40e.tar.bz2
edk2-24e25d11c0460dfb39fade685375c0e58cbcb40e.zip
• BaseMemoryLib:
Modify some Aassert()s conditions to sync with MWG 0.56d Modify some defects in function header. • PostCodeLib: Implement PeiDxePostCodeLibReportStatusCode. • Misc Rename BaseDebugLibReportStatusCode to PeiDxeDebugLibReportStatusCode Remove tabs in all .c and .h files in MdePkg. Rename PeiServicesReinstallPpi() to PeiServicesReInstallPpi() Adjust some minor coding style in PeCoffLoaderGetEntryPointerLib() git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@626 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c')
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c48
1 files changed, 22 insertions, 26 deletions
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);
}