Index: boot/generic/include/memstr.h
===================================================================
--- boot/generic/include/memstr.h	(revision 2a0800506a1ff0ea264a43ef534635ebf6a0734e)
+++ boot/generic/include/memstr.h	(revision 1715b7feb70e6c6d6bf5f4c8cb293a7bf73f8247)
@@ -36,4 +36,5 @@
 
 extern void *memcpy(void *, const void *, size_t);
+extern void *memset(void *, int, size_t);
 extern void *memmove(void *, const void *, size_t);
 
Index: boot/generic/src/memstr.c
===================================================================
--- boot/generic/src/memstr.c	(revision 2a0800506a1ff0ea264a43ef534635ebf6a0734e)
+++ boot/generic/src/memstr.c	(revision 1715b7feb70e6c6d6bf5f4c8cb293a7bf73f8247)
@@ -35,18 +35,30 @@
  * memory areas cannot overlap.
  *
- * @param src		Source address to copy from.
- * @param dst		Destination address to copy to.
- * @param cnt		Number of bytes to copy.
+ * @param src Source address to copy from.
+ * @param dst Destination address to copy to.
+ * @param cnt Number of bytes to copy.
  *
- * @return		Destination address.
+ * @return Destination address.
+ *
  */
 void *memcpy(void *dst, const void *src, size_t cnt)
 {
-	size_t i;
+	return __builtin_memcpy(dst, src, cnt);
+}
 
-	for (i = 0; i < cnt; i++)
-		((uint8_t *) dst)[i] = ((uint8_t *) src)[i];
-
-	return dst;
+/** Fill block of memory.
+ *
+ * Fill cnt bytes at dst address with the value val.
+ *
+ * @param dst Destination address to fill.
+ * @param val Value to fill.
+ * @param cnt Number of bytes to fill.
+ *
+ * @return Destination address.
+ *
+ */
+void *memset(void *dst, int val, size_t cnt)
+{
+	return __builtin_memset(dst, val, cnt);
 }
 
