diff options
author | Ashraf Ali <ashraf.ali.s@intel.com> | 2024-09-06 20:42:42 +0530 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-09-11 21:50:20 +0000 |
commit | e41e728c1640d5f3c5c24c31e088bf34f2fde197 (patch) | |
tree | f29cc8bdd4f36a2415c1ec0998b09e1f9b11b592 /MdePkg | |
parent | 03c8ec6ce29e47abca2b598bba9a05ddd87afc17 (diff) | |
download | edk2-e41e728c1640d5f3c5c24c31e088bf34f2fde197.tar.gz edk2-e41e728c1640d5f3c5c24c31e088bf34f2fde197.tar.bz2 edk2-e41e728c1640d5f3c5c24c31e088bf34f2fde197.zip |
Refactor SetMemWrapper to reduce binary size
Moved SetMemN API to a separate file to eliminate unnecessary inclusion
of InternalMemSetMem64 and InternalMemSetMem32 APIs in driver binary.
When the compiler linking the Object files it may not remove all the
unused from NASM OBJs. This change is to reorganize the C files to
minimize the impact of the NASM behavior resulting is code size
reduction.
Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
Diffstat (limited to 'MdePkg')
21 files changed, 392 insertions, 246 deletions
diff --git a/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf b/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf index e84a2c7ee5..eac88cf713 100644 --- a/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf +++ b/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf @@ -32,6 +32,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLib/SetMemNWrapper.c b/MdePkg/Library/BaseMemoryLib/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLib/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c index 39ec8cb0db..31f8bd4957 100644 --- a/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf index 18fc5875e2..2f37c69d6e 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf +++ b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf @@ -36,6 +36,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMemNWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c index 39ec8cb0db..31f8bd4957 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf index 6a7fa9a565..ed10b2e8fa 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf +++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf @@ -92,6 +92,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemNWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c index 39ec8cb0db..31f8bd4957 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf index 43c2cc2a0a..7e3136961c 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf +++ b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf @@ -33,6 +33,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/SetMemNWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibOptPei/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c index 39ec8cb0db..31f8bd4957 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf index 59983d0a0c..4dad964a97 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf +++ b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf @@ -33,6 +33,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMemNWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibRepStr/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c index 39ec8cb0db..31f8bd4957 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf index 69a29a1b7d..fbc1a7b6cf 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf +++ b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf @@ -32,6 +32,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMemNWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/BaseMemoryLibSse2/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c index 39ec8cb0db..31f8bd4957 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/UefiMemoryLib/SetMemNWrapper.c b/MdePkg/Library/UefiMemoryLib/SetMemNWrapper.c new file mode 100644 index 0000000000..8a7cfca63b --- /dev/null +++ b/MdePkg/Library/UefiMemoryLib/SetMemNWrapper.c @@ -0,0 +1,54 @@ +/** @file
+ SetMemN() implementation.
+
+ The following BaseMemoryLib instances contain the same copy of this file:
+
+ BaseMemoryLib
+ BaseMemoryLibMmx
+ BaseMemoryLibSse2
+ BaseMemoryLibRepStr
+ BaseMemoryLibOptDxe
+ BaseMemoryLibOptPei
+ PeiMemoryLib
+ UefiMemoryLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MemLibInternals.h"
+
+/**
+ 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);
+ }
+}
diff --git a/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c b/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c index 1d54a8afe1..df1247d452 100644 --- a/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c +++ b/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c @@ -1,5 +1,5 @@ /** @file
- SetMem() and SetMemN() implementation.
+ SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file:
@@ -49,37 +49,3 @@ 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);
- }
-}
diff --git a/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf b/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf index 2556225e1d..35dff7a4c3 100644 --- a/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf +++ b/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf @@ -32,6 +32,7 @@ ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
+ SetMemNWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
@@ -47,7 +48,6 @@ [Packages]
MdePkg/MdePkg.dec
-
[LibraryClasses]
BaseLib
UefiBootServicesTableLib
|