aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/lib/memset.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/microblaze/lib/memset.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/microblaze/lib/memset.c')
-rw-r--r--arch/microblaze/lib/memset.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/arch/microblaze/lib/memset.c b/arch/microblaze/lib/memset.c
index ecfb663e1fc1..ddf67939576d 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
35void *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 */
34void *memset(void *v_src, int c, __kernel_size_t n) 49void *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;
@@ -51,7 +64,7 @@ void *memset(void *v_src, int c, __kernel_size_t n)
51 64
52 if (likely(n >= 4)) { 65 if (likely(n >= 4)) {
53 /* Align the destination to a word boundary */ 66 /* Align the destination to a word boundary */
54 /* This is done in an endian independant manner */ 67 /* This is done in an endian independent manner */
55 switch ((unsigned) src & 3) { 68 switch ((unsigned) src & 3) {
56 case 1: 69 case 1:
57 *src++ = c; 70 *src++ = 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 */
82EXPORT_SYMBOL(memset); 96EXPORT_SYMBOL(memset);
83#endif /* __HAVE_ARCH_MEMSET */ 97#endif /* __HAVE_ARCH_MEMSET */