@@ -52,6 +52,26 @@ config LIB_RAND
help
This library provides pseudo-random number generator functions.
+config USE_TINY_MEMSET
+ bool "Use a size-optimized memset()"
+ help
+ This makes memset prefer code size over speed optimizations.
+ The fastest memset() is the arch-specific one (if available) enabled
+ by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
+ better performance by writing a word at a time at the cost of
+ slightly bigger memset code, but in some special cases size might
+ be more important than speed.
+
+config SPL_USE_TINY_MEMSET
+ bool "Use a size-optimized memset()"
+ help
+ This makes memset prefer code size over speed optimizations.
+ The fastest memset() is the arch-specific one (if available) enabled
+ by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
+ better performance by writing a word at a time at the cost of
+ slightly bigger memset code, but in some special cases size might
+ be more important than speed.
+
source lib/dhry/Kconfig
source lib/rsa/Kconfig
@@ -437,8 +437,10 @@ char *strswab(const char *s)
void * memset(void * s,int c,size_t count)
{
unsigned long *sl = (unsigned long *) s;
- unsigned long cl = 0;
char *s8;
+
+#if !CONFIG_IS_ENABLED(USE_TINY_MEMSET)
+ unsigned long cl = 0;
int i;
/* do it one word at a time (32 bits or 64 bits) while possible */
@@ -452,6 +454,7 @@ void * memset(void * s,int c,size_t count)
count -= sizeof(*sl);
}
}
+#endif
/* fill 8 bits at a time */
s8 = (char *)sl;
while (count--)