diff --git a/.gitmodules b/.gitmodules index 5f393ec1c..40c12c1fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,3 +18,7 @@ path = hermit/usr/newlib url = git@github.com:RWTH-OS/newlib.git branch = hermit +[submodule "hermit/lwip"] + path = hermit/lwip + url = git@github.com:RWTH-OS/LwIP.git + branch = hermit diff --git a/hermit/TODO.md b/hermit/TODO.md index ed3007460..c4d6738b1 100644 --- a/hermit/TODO.md +++ b/hermit/TODO.md @@ -2,6 +2,7 @@ TODO list ========= * using a unified term for cores and CPUs, currently we didn't differentiate +* fast implementation of memcmp is missing * prioririty handling in the Pthread library is still missing * support of signals is still missing * use gs register to accelerate tha access to newlib's reentrant structure diff --git a/hermit/include/hermit/string.h b/hermit/include/hermit/string.h index efd38af7e..a93cb8976 100644 --- a/hermit/include/hermit/string.h +++ b/hermit/include/hermit/string.h @@ -49,6 +49,10 @@ void *memcpy(void *dest, const void *src, size_t count); void *memset(void *dest, int val, size_t count); #endif +#ifndef HAVE_ARCH_MEMCMP +int memcmp(const void *s1, const void *s2, size_t n); +#endif + #ifndef HAVE_ARCH_STRLEN size_t strlen(const char *str); #endif diff --git a/hermit/libkern/string.c b/hermit/libkern/string.c index dc81870c1..68cc92b5c 100644 --- a/hermit/libkern/string.c +++ b/hermit/libkern/string.c @@ -40,6 +40,22 @@ void *memset(void *dest, int val, size_t count) } #endif +#ifndef HAVE_ARCH_MEMCMP +int memcmp(const void *s1, const void *s2, size_t n) +{ + if (n != 0) { + const unsigned char *p1 = s1, *p2 = s2; + + do { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while(--n != 0); + } + + return 0; +} +#endif + #ifndef HAVE_ARCH_STRLEN size_t strlen(const char *str) { diff --git a/hermit/lwip b/hermit/lwip new file mode 160000 index 000000000..5b8b5d459 --- /dev/null +++ b/hermit/lwip @@ -0,0 +1 @@ +Subproject commit 5b8b5d459e7dd890724515bbfad86c705234f9ec