summaryrefslogtreecommitdiff
path: root/website-kernel/arch/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'website-kernel/arch/mem.c')
-rw-r--r--website-kernel/arch/mem.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/website-kernel/arch/mem.c b/website-kernel/arch/mem.c
index 301eb74..4b9a0b0 100644
--- a/website-kernel/arch/mem.c
+++ b/website-kernel/arch/mem.c
@@ -1,5 +1,6 @@
#include <int.h>
#include <sys.h>
+#include <log.h>
static struct mempage_t *root;
@@ -24,7 +25,6 @@ void set_root(struct mempage_t *incoming_root) {
}
void *kmalloc(size_t size) {
-
size = sizeof(size_t) + round_size(size, sizeof(struct mempage_t));
struct mempage_t *parent = NULL;
struct mempage_t *node = root;
@@ -92,3 +92,16 @@ void memzero(void *ptr, size_t size) {
((uint8_t *)ptr)[i] = 0;
}
}
+
+int memcmp(const void *s1, const void *s2, size_t n) {
+ const unsigned char *p1 = (const unsigned char *)s1;
+ const unsigned char *p2 = (const unsigned char *)s2;
+
+ for (size_t i = 0; i < n; i++) {
+ if (p1[i] != p2[i]) {
+ return p1[i] - p2[i];
+ }
+ }
+
+ return 0;
+}