diff options
Diffstat (limited to 'src/kernel/util.c')
-rw-r--r-- | src/kernel/util.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/kernel/util.c b/src/kernel/util.c index df6e7d8..c7a5035 100644 --- a/src/kernel/util.c +++ b/src/kernel/util.c @@ -2,8 +2,15 @@ #include "panic.h" #include <stdbool.h> -void memcpy(void *from, void *to, uint32_t n) { - panic("Not implemented (memcpy)."); +void memcpy(void *to, void *from, uint32_t n) { + uint32_t *tp = to, *fp = from; + while (n >= 4) { + *(tp++) = *(fp++); + n -= 4; + } + uint8_t *tpp = (uint8_t *)tp, *fpp = (uint8_t *)fp; + while (n--) + *(tpp++) = *(fpp++); } void u32_dec(uint32_t n, uint8_t *b) { |