X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseMemoryLibOptDxe%2FSetMemWrapper.c;h=6e86472ace43dfec4450237b200bafafc29f5bf5;hp=10224f73b8badb3d6afaf63caaad6d3ce7df5f4b;hb=9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107;hpb=2bfb60098f608dc32ff5d22b0fd087c1636b0881 diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c index 10224f73b8..6e86472ace 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c @@ -1,14 +1,5 @@ /** @file - SetMem() implementation. - - Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + SetMem() and SetMemN() implementation. The following BaseMemoryLib instances contain the same copy of this file: @@ -19,12 +10,18 @@ BaseMemoryLibOptDxe BaseMemoryLibOptPei PeiMemoryLib - DxeMemoryLib - -**/ + UefiMemoryLib + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ #include "MemLibInternals.h" @@ -32,11 +29,12 @@ Fills a target buffer with a byte value, and returns the target buffer. This function fills Length bytes of Buffer with Value, and returns Buffer. - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - @param Buffer Memory to set. - @param Length Number of bytes to set. - @param Value Value of the set operation. + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). + + @param Buffer The memory to set. + @param Length The number of bytes to set. + @param Value The value with which to fill Length bytes of Buffer. @return Buffer. @@ -57,3 +55,37 @@ SetMem ( return InternalMemSetMem (Buffer, Length, Value); } + +/** + Fills a target buffer with a value that is size UINTN, and returns the target buffer. + + This function fills Length bytes of Buffer with the UINTN sized value specified by + Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length + bytes of Buffer. + + If Length > 0 and Buffer is NULL, then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). + If Buffer is not aligned on a UINTN boundary, then ASSERT(). + If Length is not aligned on a UINTN boundary, then ASSERT(). + + @param Buffer The pointer to the target buffer to fill. + @param Length The number of bytes in Buffer to fill. + @param Value The value with which to fill Length bytes of Buffer. + + @return Buffer. + +**/ +VOID * +EFIAPI +SetMemN ( + OUT VOID *Buffer, + IN UINTN Length, + IN UINTN Value + ) +{ + if (sizeof (UINTN) == sizeof (UINT64)) { + return SetMem64 (Buffer, Length, (UINT64)Value); + } else { + return SetMem32 (Buffer, Length, (UINT32)Value); + } +}