]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c
Removed CommonHeader.h generated file from the MdePkg.
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibRepStr / CopyMemWrapper.c
CommitLineData
e1f414b6 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
22 DxeMemoryLib\r
23\r
24**/\r
25\r
26//\r
27// Include common header file for this module.\r
28//\r
f734a10a 29\r
e1f414b6 30\r
31#include "MemLibInternals.h"\r
32\r
33/**\r
34 Copies a source buffer to a destination buffer, and returns the destination buffer.\r
35\r
36 This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns\r
37 DestinationBuffer. The implementation must be reentrant, and it must handle the case\r
38 where SourceBuffer overlaps DestinationBuffer.\r
39 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). \r
40 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). \r
41\r
42 @param DestinationBuffer Pointer to the destination buffer of the memory copy.\r
43 @param SourceBuffer Pointer to the source buffer of the memory copy.\r
44 @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.\r
45\r
46 @return DestinationBuffer.\r
47\r
48**/\r
49VOID *\r
50EFIAPI\r
51CopyMem (\r
52 OUT VOID *DestinationBuffer,\r
53 IN CONST VOID *SourceBuffer,\r
54 IN UINTN Length\r
55 )\r
56{\r
57 if (Length == 0) {\r
58 return DestinationBuffer;\r
59 }\r
60 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
61 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
62\r
63 if (DestinationBuffer == SourceBuffer) {\r
64 return DestinationBuffer;\r
65 }\r
66 return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);\r
67}\r