Skip to content

Commit

Permalink
QuarkSocPkg/MemoryInit: Remove use of memset()/memcpy()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Kelly Steele <[email protected]>
  • Loading branch information
mdkinney committed Aug 10, 2017
1 parent 95cc9a5 commit 8e8cc68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -74,7 +74,3 @@

[Depex]
TRUE

[BuildOptions]
# /Oi option to use the intrinsic memset function in source code.
MSFT:*_*_*_CC_FLAGS = /Oi
10 changes: 7 additions & 3 deletions QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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_

0 comments on commit 8e8cc68

Please sign in to comment.