summaryrefslogtreecommitdiff
path: root/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
diff options
context:
space:
mode:
Diffstat (limited to 'CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c')
-rw-r--r--CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
index 48e0c52c36..afaa0b74ee 100644
--- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
+++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
@@ -23,5 +23,17 @@ int _fltused = 1;
/* Sets buffers to a specified character */
void * memset (void *dest, char ch, unsigned int count)
{
- return SetMem (dest, (UINTN)count, (UINT8)ch);
+ //
+ // Declare the local variables that actually move the data elements as
+ // volatile to prevent the optimizer from replacing this function with
+ // the intrinsic memset()
+ //
+ volatile UINT8 *Pointer;
+
+ Pointer = (UINT8 *)dest;
+ while (count-- != 0) {
+ *(Pointer++) = ch;
+ }
+
+ return dest;
}