1 /** @file 2 Base Memory Library functions implementation bases on PeiServcie. 3 4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #include "MemLibInternals.h" 16 17 /** 18 Copies a source buffer to a destination buffer, and returns the destination buffer. 19 20 This function wraps the gPS->CopyMem (). 21 22 @param DestinationBuffer The pointer to the destination buffer of the memory copy. 23 @param SourceBuffer The pointer to the source buffer of the memory copy. 24 @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. 25 26 @return DestinationBuffer. 27 28 **/ 29 VOID * 30 EFIAPI 31 InternalMemCopyMem ( 32 OUT VOID *Destination, 33 IN CONST VOID *Source, 34 IN UINTN Length 35 ) 36 { 37 (*GetPeiServicesTablePointer ())->CopyMem ( 38 Destination, 39 (VOID*)Source, 40 Length 41 ); 42 return Destination; 43 } 44 45 /** 46 Fills a target buffer with a byte value, and returns the target buffer. 47 48 This function wraps the gPS->SetMem (). 49 50 @param Buffer Memory to set. 51 @param Size The number of bytes to set. 52 @param Value Value of the set operation. 53 54 @return Buffer. 55 56 **/ 57 VOID * 58 EFIAPI 59 InternalMemSetMem ( 60 OUT VOID *Buffer, 61 IN UINTN Size, 62 IN UINT8 Value 63 ) 64 { 65 (*GetPeiServicesTablePointer ())->SetMem ( 66 Buffer, 67 Size, 68 Value 69 ); 70 return Buffer; 71 } 72