]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiMemoryLib/MemLib.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / PeiMemoryLib / MemLib.c
1 /** @file
2 Base Memory Library functions implementation bases on PeiServcie.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "MemLibInternals.h"
10
11 /**
12 Copies a source buffer to a destination buffer, and returns the destination buffer.
13
14 This function wraps the gPS->CopyMem ().
15
16 @param DestinationBuffer The pointer to the destination buffer of the memory copy.
17 @param SourceBuffer The pointer to the source buffer of the memory copy.
18 @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer.
19
20 @return DestinationBuffer.
21
22 **/
23 VOID *
24 EFIAPI
25 InternalMemCopyMem (
26 OUT VOID *Destination,
27 IN CONST VOID *Source,
28 IN UINTN Length
29 )
30 {
31 (*GetPeiServicesTablePointer ())->CopyMem (
32 Destination,
33 (VOID*)Source,
34 Length
35 );
36 return Destination;
37 }
38
39 /**
40 Fills a target buffer with a byte value, and returns the target buffer.
41
42 This function wraps the gPS->SetMem ().
43
44 @param Buffer Memory to set.
45 @param Size The number of bytes to set.
46 @param Value Value of the set operation.
47
48 @return Buffer.
49
50 **/
51 VOID *
52 EFIAPI
53 InternalMemSetMem (
54 OUT VOID *Buffer,
55 IN UINTN Size,
56 IN UINT8 Value
57 )
58 {
59 (*GetPeiServicesTablePointer ())->SetMem (
60 Buffer,
61 Size,
62 Value
63 );
64 return Buffer;
65 }