Home | History | Annotate | Download | only in BaseMemoryLibOptDxe
      1 /** @file
      2   ZeroMem() implementation.
      3 
      4   The following BaseMemoryLib instances contain the same copy of this file:
      5 
      6     BaseMemoryLib
      7     BaseMemoryLibMmx
      8     BaseMemoryLibSse2
      9     BaseMemoryLibRepStr
     10     BaseMemoryLibOptDxe
     11     BaseMemoryLibOptPei
     12     PeiMemoryLib
     13     UefiMemoryLib
     14 
     15   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     16   This program and the accompanying materials
     17   are licensed and made available under the terms and conditions of the BSD License
     18   which accompanies this distribution.  The full text of the license may be found at
     19   http://opensource.org/licenses/bsd-license.php.
     20 
     21   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     22   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     23 
     24 **/
     25 
     26 #include "MemLibInternals.h"
     27 
     28 /**
     29   Fills a target buffer with zeros, and returns the target buffer.
     30 
     31   This function fills Length bytes of Buffer with zeros, and returns Buffer.
     32 
     33   If Length > 0 and Buffer is NULL, then ASSERT().
     34   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
     35 
     36   @param  Buffer      The pointer to the target buffer to fill with zeros.
     37   @param  Length      The number of bytes in Buffer to fill with zeros.
     38 
     39   @return Buffer.
     40 
     41 **/
     42 VOID *
     43 EFIAPI
     44 ZeroMem (
     45   OUT VOID  *Buffer,
     46   IN UINTN  Length
     47   )
     48 {
     49   if (Length == 0) {
     50     return Buffer;
     51   }
     52 
     53   ASSERT (Buffer != NULL);
     54   ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
     55   return InternalMemZeroMem (Buffer, Length);
     56 }
     57