]> git.proxmox.com Git - mirror_edk2.git/blame - OldMdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c
Remove includes from INF
[mirror_edk2.git] / OldMdePkg / Library / BaseMemoryLibRepStr / CopyMemWrapper.c
CommitLineData
608fd3fd 1/** @file\r
2 CopyMem() implementation.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Module Name: CopyMemWrapper.c\r
14\r
15 The following BaseMemoryLib instances share the same version of this file:\r
16\r
17 BaseMemoryLib\r
18 BaseMemoryLibMmx\r
19 BaseMemoryLibSse2\r
20 BaseMemoryLibRepStr\r
21 PeiMemoryLib\r
add13dc2 22 DxeMemoryLib\r
608fd3fd 23\r
24**/\r
25\r
24de7645 26#include "MemLibInternals.h"\r
608fd3fd 27\r
28/**\r
24e25d11 29 Copies a source buffer to a destination buffer, and returns the destination buffer.\r
608fd3fd 30\r
24e25d11 31 This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns\r
32 DestinationBuffer. The implementation must be reentrant, and it must handle the case\r
33 where SourceBuffer overlaps DestinationBuffer.\r
34 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). \r
35 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). \r
608fd3fd 36\r
24e25d11 37 @param DestinationBuffer Pointer to the destination buffer of the memory copy.\r
38 @param SourceBuffer Pointer to the source buffer of the memory copy.\r
39 @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.\r
608fd3fd 40\r
24e25d11 41 @return DestinationBuffer.\r
608fd3fd 42\r
43**/\r
44VOID *\r
45EFIAPI\r
46CopyMem (\r
24e25d11 47 OUT VOID *DestinationBuffer,\r
48 IN CONST VOID *SourceBuffer,\r
49 IN UINTN Length\r
608fd3fd 50 )\r
51{\r
24e25d11 52 if (Length == 0) {\r
53 return DestinationBuffer;\r
54 }\r
55 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
56 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
57\r
58 if (DestinationBuffer == SourceBuffer) {\r
59 return DestinationBuffer;\r
608fd3fd 60 }\r
24e25d11 61 return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);\r
608fd3fd 62}\r