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