Map the use of memset() and memcpy() to the BaseMemoryLib
functions ZeroMem(), SetMem(), and CopyMem(). This fixes
GCC build issues with this module.
With the remap of the functions, the [BuildOptions] MSFT
CC_FLAGS to enable /Oi can also be removed, so the MSFT
and GCC builds behave the same.
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
## @file\r
# This is the Memory Initialization Driver for Quark\r
#\r
## @file\r
# This is the Memory Initialization Driver for Quark\r
#\r
-# Copyright (c) 2013-2015 Intel Corporation.\r
+# Copyright (c) 2013-2017 Intel Corporation.\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
-\r
-[BuildOptions]\r
- # /Oi option to use the intrinsic memset function in source code.\r
- MSFT:*_*_*_CC_FLAGS = /Oi\r
/************************************************************************\r
*\r
/************************************************************************\r
*\r
- * Copyright (c) 2013-2015 Intel Corporation.\r
+ * Copyright (c) 2013-2017 Intel Corporation.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
void default_timings(MRCParams_t *mrc_params);\r
\r
#ifndef SIM\r
void default_timings(MRCParams_t *mrc_params);\r
\r
#ifndef SIM\r
-void *memset(void *d, int c, size_t n);\r
-void *memcpy(void *d, const void *s, size_t n);\r
+//\r
+// Map memset() and memcpy() to BaseMemoryLib functions\r
+//\r
+#include <Library/BaseMemoryLib.h>\r
+#define memset(d,c,n) ((c) == 0) ? ZeroMem ((d), (n)) : SetMem ((d), (n), (c))\r
+#define memcpy(d,s,n) CopyMem ((d), (s), (n))\r
#endif\r
\r
#endif // _MEMINIT_UTILS_H_\r
#endif\r
\r
#endif // _MEMINIT_UTILS_H_\r