public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Michael D Kinney <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Kelly Steele <kelly.steele@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch 1/2] QuarkSocPkg/MemoryInit: Remove use of memset()/memcpy()
Date: Wed,  9 Aug 2017 12:39:56 -0700	[thread overview]
Message-ID: <20170809193957.10644-2-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20170809193957.10644-1-michael.d.kinney@intel.com>

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>
---
 QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf |  6 +-----
 QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h   | 10 +++++++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
index 78821f59a3..05766133ed 100644
--- a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
+++ b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
@@ -1,7 +1,7 @@
 ## @file
 # This is the Memory Initialization Driver for Quark
 #
-# Copyright (c) 2013-2015 Intel Corporation.
+# Copyright (c) 2013-2017 Intel Corporation.
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -74,7 +74,3 @@
 
 [Depex]
   TRUE
-
-[BuildOptions]
-  # /Oi option to use the intrinsic memset function in source code.
-  MSFT:*_*_*_CC_FLAGS = /Oi
diff --git a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
index 04c59f5af0..dcc40c7782 100644
--- a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
+++ b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
@@ -1,6 +1,6 @@
 /************************************************************************
  *
- * Copyright (c) 2013-2015 Intel Corporation.
+ * Copyright (c) 2013-2017 Intel Corporation.
  *
 * This program and the accompanying materials
 * are licensed and made available under the terms and conditions of the BSD License
@@ -90,8 +90,12 @@ void restore_timings(MRCParams_t *mrc_params);
 void default_timings(MRCParams_t *mrc_params);
 
 #ifndef SIM
-void *memset(void *d, int c, size_t n);
-void *memcpy(void *d, const void *s, size_t n);
+//
+// Map memset() and memcpy() to BaseMemoryLib functions
+//
+#include <Library/BaseMemoryLib.h>
+#define memset(d,c,n) ((c) == 0) ? ZeroMem ((d), (n)) : SetMem ((d), (n), (c))
+#define memcpy(d,s,n) CopyMem ((d), (s), (n))
 #endif
 
 #endif // _MEMINIT_UTILS_H_
-- 
2.13.1.windows.2



  reply	other threads:[~2017-08-09 19:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 19:39 [Patch 0/2] Update Quark for edk2-non-osi changes Michael D Kinney
2017-08-09 19:39 ` Michael D Kinney [this message]
2017-08-10 16:37   ` [Patch 1/2] QuarkSocPkg/MemoryInit: Remove use of memset()/memcpy() Steele, Kelly
2017-08-09 19:39 ` [Patch 2/2] QuarkPlatformPkg/Readme.md: edk2-non-osi directory layout Michael D Kinney
2017-08-10  8:40   ` Leif Lindholm
2017-08-10 16:37   ` Steele, Kelly
2017-08-10 16:38 ` [Patch 0/2] Update Quark for edk2-non-osi changes Steele, Kelly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170809193957.10644-2-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox