]> git.proxmox.com Git - mirror_edk2.git/commitdiff
QuarkSocPkg/MemoryInit: Remove use of memset()/memcpy()
authorMichael D Kinney <michael.d.kinney@intel.com>
Wed, 9 Aug 2017 19:19:46 +0000 (12:19 -0700)
committerMichael D Kinney <michael.d.kinney@intel.com>
Thu, 10 Aug 2017 16:44:17 +0000 (09:44 -0700)
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>
QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h

index 78821f59a3e15a7856ea581bf1e270946e4caf19..05766133ed40a2b7dd96da477d47554d4cc22cce 100644 (file)
@@ -1,7 +1,7 @@
 ## @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
@@ -74,7 +74,3 @@
 \r
 [Depex]\r
   TRUE\r
-\r
-[BuildOptions]\r
-  # /Oi option to use the intrinsic memset function in source code.\r
-  MSFT:*_*_*_CC_FLAGS = /Oi\r
index 04c59f5af07f3cffbb717c78ddfaf87c213403b4..dcc40c7782a6b956b3c456566a8743a750adaa53 100644 (file)
@@ -1,6 +1,6 @@
 /************************************************************************\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
@@ -90,8 +90,12 @@ void restore_timings(MRCParams_t *mrc_params);
 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