• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Base Memory Library functions implementation bases on Uefi Boot Service.
3 
4   Copyright (c) 2006 - 2008, 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 gBS->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
InternalMemCopyMem(OUT VOID * Destination,IN CONST VOID * Source,IN UINTN Length)31 InternalMemCopyMem (
32   OUT     VOID                      *Destination,
33   IN      CONST VOID                *Source,
34   IN      UINTN                     Length
35   )
36 {
37   gBS->CopyMem (Destination, (VOID*)Source, Length);
38   return Destination;
39 }
40 
41 /**
42   Fills a target buffer with a byte value, and returns the target buffer.
43 
44   This function wraps the gBS->SetMem().
45 
46   @param  Buffer    Memory to set.
47   @param  Size      The number of bytes to set.
48   @param  Value     Value of the set operation.
49 
50   @return Buffer.
51 
52 **/
53 VOID *
54 EFIAPI
InternalMemSetMem(OUT VOID * Buffer,IN UINTN Size,IN UINT8 Value)55 InternalMemSetMem (
56   OUT     VOID                      *Buffer,
57   IN      UINTN                     Size,
58   IN      UINT8                     Value
59   )
60 {
61   gBS->SetMem (Buffer, Size, Value);
62   return Buffer;
63 }
64