diff options
Diffstat (limited to 'arch/microblaze/lib/memset.c')
-rw-r--r-- | arch/microblaze/lib/memset.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/microblaze/lib/memset.c b/arch/microblaze/lib/memset.c index ecfb663e1fc1..834565d1607e 100644 --- a/arch/microblaze/lib/memset.c +++ b/arch/microblaze/lib/memset.c | |||
@@ -31,17 +31,30 @@ | |||
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | 32 | ||
33 | #ifdef __HAVE_ARCH_MEMSET | 33 | #ifdef __HAVE_ARCH_MEMSET |
34 | #ifndef CONFIG_OPT_LIB_FUNCTION | ||
35 | void *memset(void *v_src, int c, __kernel_size_t n) | ||
36 | { | ||
37 | char *src = v_src; | ||
38 | |||
39 | /* Truncate c to 8 bits */ | ||
40 | c = (c & 0xFF); | ||
41 | |||
42 | /* Simple, byte oriented memset or the rest of count. */ | ||
43 | while (n--) | ||
44 | *src++ = c; | ||
45 | |||
46 | return v_src; | ||
47 | } | ||
48 | #else /* CONFIG_OPT_LIB_FUNCTION */ | ||
34 | void *memset(void *v_src, int c, __kernel_size_t n) | 49 | void *memset(void *v_src, int c, __kernel_size_t n) |
35 | { | 50 | { |
36 | char *src = v_src; | 51 | char *src = v_src; |
37 | #ifdef CONFIG_OPT_LIB_FUNCTION | ||
38 | uint32_t *i_src; | 52 | uint32_t *i_src; |
39 | uint32_t w32 = 0; | 53 | uint32_t w32 = 0; |
40 | #endif | 54 | |
41 | /* Truncate c to 8 bits */ | 55 | /* Truncate c to 8 bits */ |
42 | c = (c & 0xFF); | 56 | c = (c & 0xFF); |
43 | 57 | ||
44 | #ifdef CONFIG_OPT_LIB_FUNCTION | ||
45 | if (unlikely(c)) { | 58 | if (unlikely(c)) { |
46 | /* Make a repeating word out of it */ | 59 | /* Make a repeating word out of it */ |
47 | w32 = c; | 60 | w32 = c; |
@@ -72,12 +85,13 @@ void *memset(void *v_src, int c, __kernel_size_t n) | |||
72 | 85 | ||
73 | src = (void *)i_src; | 86 | src = (void *)i_src; |
74 | } | 87 | } |
75 | #endif | 88 | |
76 | /* Simple, byte oriented memset or the rest of count. */ | 89 | /* Simple, byte oriented memset or the rest of count. */ |
77 | while (n--) | 90 | while (n--) |
78 | *src++ = c; | 91 | *src++ = c; |
79 | 92 | ||
80 | return v_src; | 93 | return v_src; |
81 | } | 94 | } |
95 | #endif /* CONFIG_OPT_LIB_FUNCTION */ | ||
82 | EXPORT_SYMBOL(memset); | 96 | EXPORT_SYMBOL(memset); |
83 | #endif /* __HAVE_ARCH_MEMSET */ | 97 | #endif /* __HAVE_ARCH_MEMSET */ |