summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc1
-rw-r--r--src/lib/string.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 2fd4e4ca0c..68431f9ce5 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -118,6 +118,7 @@ ramstage-y += bootmem.c
ramstage-y += fmap.c
ramstage-y += memchr.c
ramstage-y += memcmp.c
+ramstage-y += string.c
ramstage-y += malloc.c
smm-$(CONFIG_SMM_TSEG) += malloc.c
ramstage-y += dimm_info_util.c
diff --git a/src/lib/string.c b/src/lib/string.c
new file mode 100644
index 0000000000..df2fd80849
--- /dev/null
+++ b/src/lib/string.c
@@ -0,0 +1,21 @@
+#include <string.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+char *strdup(const char *s)
+{
+ size_t sz = strlen(s) + 1;
+ char *d = malloc(sz);
+ memcpy(d, s, sz);
+ return d;
+}
+
+char *strconcat(const char *s1, const char *s2)
+{
+ size_t sz_1 = strlen(s1);
+ size_t sz_2 = strlen(s2);
+ char *d = malloc(sz_1 + sz_2 + 1);
+ memcpy(d, s1, sz_1);
+ memcpy(d + sz_1, s2, sz_2 + 1);
+ return d;
+}