diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2014-03-18 15:26:40 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-03-19 18:44:09 -0400 |
commit | 04999550f93234bf05597a9b7d26e2bfe27ba883 (patch) | |
tree | 633f18a3225e8e898a65f4f1d95f2577e6ccf924 /arch/x86/boot/compressed/misc.c | |
parent | fb4cac573ef6dce8d7543b68306566561c2e5725 (diff) |
x86, boot: Move memset() definition in compressed/string.c
Currently compressed/misc.c needs to link against memset(). I think one of
the reasons of this need is inclusion of various header files which define
static inline functions and use memset() inside these. For example,
include/linux/bitmap.h
I think trying to include "../string.h" and using builtin version of memset
does not work because by the time "#define memset" shows up, it is too
late. Some other header file has already used memset() and expects to
find a definition during link phase.
Currently we have a C definitoin of memset() in misc.c. Move it to
compressed/string.c so that others can use it if need be.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Link: http://lkml.kernel.org/r/1395170800-11059-6-git-send-email-vgoyal@redhat.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/boot/compressed/misc.c')
-rw-r--r-- | arch/x86/boot/compressed/misc.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 3100092b1346..17684615374b 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -98,8 +98,14 @@ | |||
98 | */ | 98 | */ |
99 | #define STATIC static | 99 | #define STATIC static |
100 | 100 | ||
101 | #undef memset | ||
102 | #undef memcpy | 101 | #undef memcpy |
102 | |||
103 | /* | ||
104 | * Use a normal definition of memset() from string.c. There are already | ||
105 | * included header files which expect a definition of memset() and by | ||
106 | * the time we define memset macro, it is too late. | ||
107 | */ | ||
108 | #undef memset | ||
103 | #define memzero(s, n) memset((s), 0, (n)) | 109 | #define memzero(s, n) memset((s), 0, (n)) |
104 | 110 | ||
105 | 111 | ||
@@ -110,8 +116,6 @@ static void error(char *m); | |||
110 | */ | 116 | */ |
111 | struct boot_params *real_mode; /* Pointer to real-mode data */ | 117 | struct boot_params *real_mode; /* Pointer to real-mode data */ |
112 | 118 | ||
113 | void *memset(void *s, int c, size_t n); | ||
114 | |||
115 | memptr free_mem_ptr; | 119 | memptr free_mem_ptr; |
116 | memptr free_mem_end_ptr; | 120 | memptr free_mem_end_ptr; |
117 | 121 | ||
@@ -216,16 +220,6 @@ void __putstr(const char *s) | |||
216 | outb(0xff & (pos >> 1), vidport+1); | 220 | outb(0xff & (pos >> 1), vidport+1); |
217 | } | 221 | } |
218 | 222 | ||
219 | void *memset(void *s, int c, size_t n) | ||
220 | { | ||
221 | int i; | ||
222 | char *ss = s; | ||
223 | |||
224 | for (i = 0; i < n; i++) | ||
225 | ss[i] = c; | ||
226 | return s; | ||
227 | } | ||
228 | |||
229 | static void error(char *x) | 223 | static void error(char *x) |
230 | { | 224 | { |
231 | error_putstr("\n\n"); | 225 | error_putstr("\n\n"); |