summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/arch/i386/gdt/gdt.c2
-rw-r--r--src/kernel/arch/i386/pagedir.c2
-rw-r--r--src/kernel/mem/virt.c1
-rw-r--r--src/kernel/proc.c2
-rw-r--r--src/kernel/syscalls.c1
-rw-r--r--src/kernel/tests/util.c2
-rw-r--r--src/kernel/tests/vfs.c2
-rw-r--r--src/kernel/util.c28
-rw-r--r--src/kernel/util.h5
-rw-r--r--src/kernel/vfs/mount.c2
-rw-r--r--src/kernel/vfs/path.c1
-rw-r--r--src/kernel/vfs/root.c2
12 files changed, 10 insertions, 40 deletions
diff --git a/src/kernel/arch/i386/gdt/gdt.c b/src/kernel/arch/i386/gdt/gdt.c
index 6958bb5..56df995 100644
--- a/src/kernel/arch/i386/gdt/gdt.c
+++ b/src/kernel/arch/i386/gdt/gdt.c
@@ -1,6 +1,6 @@
#include <kernel/arch/generic.h>
#include <kernel/arch/i386/gdt.h>
-#include <kernel/util.h>
+#include <shared/mem.h>
#include <stdbool.h>
#include <stdint.h>
diff --git a/src/kernel/arch/i386/pagedir.c b/src/kernel/arch/i386/pagedir.c
index 5dd36ec..88f6ebb 100644
--- a/src/kernel/arch/i386/pagedir.c
+++ b/src/kernel/arch/i386/pagedir.c
@@ -1,6 +1,6 @@
#include <kernel/arch/generic.h>
#include <kernel/mem/alloc.h>
-#include <kernel/util.h>
+#include <shared/mem.h>
#include <stdint.h>
/* <heat> nitpick: I highly recommend you dont use bitfields for paging
diff --git a/src/kernel/mem/virt.c b/src/kernel/mem/virt.c
index b15297e..f0dca06 100644
--- a/src/kernel/mem/virt.c
+++ b/src/kernel/mem/virt.c
@@ -1,6 +1,7 @@
#include <kernel/arch/generic.h>
#include <kernel/mem/virt.h>
#include <kernel/util.h>
+#include <shared/mem.h>
void virt_iter_new(
struct virt_iter *iter, void __user *virt, size_t length,
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index aebd509..e67af19 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -3,8 +3,8 @@
#include <kernel/mem/virt.h>
#include <kernel/panic.h>
#include <kernel/proc.h>
-#include <kernel/util.h>
#include <kernel/vfs/mount.h>
+#include <shared/mem.h>
#include <stdint.h>
struct process *process_first;
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 9a9b5d6..9948506 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -5,6 +5,7 @@
#include <kernel/proc.h>
#include <kernel/vfs/path.h>
#include <shared/flags.h>
+#include <shared/mem.h>
#include <shared/syscalls.h>
#include <stdint.h>
diff --git a/src/kernel/tests/util.c b/src/kernel/tests/util.c
index 3efbee8..05bba24 100644
--- a/src/kernel/tests/util.c
+++ b/src/kernel/tests/util.c
@@ -1,6 +1,6 @@
#include <kernel/tests/base.h>
#include <kernel/tests/tests.h>
-#include <kernel/util.h>
+#include <shared/mem.h>
TEST(memcmp) {
// basic equality checks
diff --git a/src/kernel/tests/vfs.c b/src/kernel/tests/vfs.c
index 339c6bd..8b749b4 100644
--- a/src/kernel/tests/vfs.c
+++ b/src/kernel/tests/vfs.c
@@ -1,9 +1,9 @@
#include <kernel/mem/alloc.h>
#include <kernel/tests/base.h>
#include <kernel/tests/tests.h>
-#include <kernel/util.h>
#include <kernel/vfs/mount.h>
#include <kernel/vfs/path.h>
+#include <shared/mem.h>
TEST(path_simplify) {
#define TEST_WRAPPER(argument, result) do { \
diff --git a/src/kernel/util.c b/src/kernel/util.c
deleted file mode 100644
index 0977745..0000000
--- a/src/kernel/util.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <kernel/util.h>
-#include <stdint.h>
-
-void *memcpy(void *dest, const void *src, size_t n) {
- char *d = dest;
- const char *s = src;
- for (size_t i = 0; i < n; i++)
- d[i] = s[i];
- return dest;
-}
-
-void *memset(void *s, int c, size_t n) {
- uint8_t *s2 = s;
- for (size_t i = 0; i < n; n++)
- s2[i] = c;
- return s;
-}
-
-int memcmp(const void *s1, const void *s2, size_t n) {
- const unsigned char *c1 = s1, *c2 = s2;
- for (size_t i = 0; i < n; i++) {
- if (c1[i] != c2[i]) {
- if (c1[i] < c2[i]) return -1;
- else return 1;
- }
- }
- return 0;
-}
diff --git a/src/kernel/util.h b/src/kernel/util.h
index 839aa49..9b8cb3d 100644
--- a/src/kernel/util.h
+++ b/src/kernel/util.h
@@ -4,11 +4,6 @@
#define __NUM2STR(x) #x
#define NUM2STR(x) __NUM2STR(x)
-void *memcpy(void *dest, const void *src, size_t n);
-void *memset(void *s, int c, size_t n);
-
-int memcmp(const void *s1, const void *s2, size_t n);
-
// see https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
#define min(a,b) ({ \
typeof (a) _a = (a); \
diff --git a/src/kernel/vfs/mount.c b/src/kernel/vfs/mount.c
index b6b3e8d..c962ba5 100644
--- a/src/kernel/vfs/mount.c
+++ b/src/kernel/vfs/mount.c
@@ -1,6 +1,6 @@
#include <kernel/mem/alloc.h>
-#include <kernel/util.h>
#include <kernel/vfs/mount.h>
+#include <shared/mem.h>
struct vfs_mount *vfs_mount_seed(void) {
struct vfs_mount *mount = kmalloc(sizeof *mount);
diff --git a/src/kernel/vfs/path.c b/src/kernel/vfs/path.c
index 096d3fe..df5f00f 100644
--- a/src/kernel/vfs/path.c
+++ b/src/kernel/vfs/path.c
@@ -1,5 +1,6 @@
#include <kernel/vfs/path.h>
#include <kernel/panic.h>
+#include <shared/mem.h>
int path_simplify(const char *in, char *out, size_t len) {
if (len == 0) return -1; // empty paths are invalid
diff --git a/src/kernel/vfs/root.c b/src/kernel/vfs/root.c
index 834bed7..adf1bfe 100644
--- a/src/kernel/vfs/root.c
+++ b/src/kernel/vfs/root.c
@@ -1,8 +1,8 @@
#include <kernel/mem/virt.h>
#include <kernel/panic.h>
#include <kernel/proc.h>
-#include <kernel/util.h>
#include <kernel/vfs/root.h>
+#include <shared/mem.h>
enum {
HANDLE_ROOT,