diff --git a/string.c b/string.c index c6b6de6af644b0ee0c5b6cd03c8dbd490af462d7..cb890eebf08db9a604e5f58cadebdd5553584970 100644 --- a/string.c +++ b/string.c @@ -1,14 +1,10 @@ #include "types.h" +#include "x86.h" void* memset(void *dst, int c, uint n) { - char *d; - - d = (char*)dst; - while(n-- > 0) - *d++ = c; - + stosb(dst, c, n); return dst; } diff --git a/ulib.c b/ulib.c index ed2542dd974a492ad9158eabfac57f714c03b363..0268c262e8d6059adfd2ef1d312373f2d4789d58 100644 --- a/ulib.c +++ b/ulib.c @@ -2,6 +2,7 @@ #include "stat.h" #include "fcntl.h" #include "user.h" +#include "x86.h" char* strcpy(char *s, char *t) @@ -35,11 +36,7 @@ strlen(char *s) void* memset(void *dst, int c, uint n) { - char *d; - - d = dst; - while(n-- > 0) - *d++ = c; + stosb(dst, c, n); return dst; }