SetMem32Wrapper.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /** @file
  2. SetMem32() implementation.
  3. The following BaseMemoryLib instances contain the same copy of this file:
  4. BaseMemoryLib
  5. BaseMemoryLibMmx
  6. BaseMemoryLibSse2
  7. BaseMemoryLibRepStr
  8. BaseMemoryLibOptDxe
  9. BaseMemoryLibOptPei
  10. PeiMemoryLib
  11. UefiMemoryLib
  12. Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
  13. SPDX-License-Identifier: BSD-2-Clause-Patent
  14. **/
  15. #include "MemLibInternals.h"
  16. /**
  17. Fills a target buffer with a 32-bit value, and returns the target buffer.
  18. This function fills Length bytes of Buffer with the 32-bit value specified by
  19. Value, and returns Buffer. Value is repeated every 32-bits in for Length
  20. bytes of Buffer.
  21. If Length > 0 and Buffer is NULL, then ASSERT().
  22. If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
  23. If Buffer is not aligned on a 32-bit boundary, then ASSERT().
  24. If Length is not aligned on a 32-bit boundary, then ASSERT().
  25. @param Buffer The pointer to the target buffer to fill.
  26. @param Length The number of bytes in Buffer to fill.
  27. @param Value The value with which to fill Length bytes of Buffer.
  28. @return Buffer.
  29. **/
  30. VOID *
  31. EFIAPI
  32. SetMem32 (
  33. OUT VOID *Buffer,
  34. IN UINTN Length,
  35. IN UINT32 Value
  36. )
  37. {
  38. if (Length == 0) {
  39. return Buffer;
  40. }
  41. ASSERT (Buffer != NULL);
  42. ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
  43. ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);
  44. ASSERT ((Length & (sizeof (Value) - 1)) == 0);
  45. return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value);
  46. }