summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2023-01-30 00:05:53 +0000
committerAda Christine <adachristine18@gmail.com>2023-01-30 00:05:53 +0000
commit798b1dc391f424868f5f4bac8937c191ed4716b8 (patch)
tree44269b4f29b8c6762657e12a02ac33063b665461
parentfba7a0f3cde6217235663fcfb300b63cb8d7c2df (diff)
headers moved around
-rw-r--r--api/lib/elf.h (renamed from lib/elf.h)0
-rw-r--r--api/lib/kstdio.h (renamed from lib/kstdio.h)2
-rw-r--r--api/lib/kstring.h (renamed from lib/sophialib.h)0
-rw-r--r--api/lib/sophialib.h14
-rw-r--r--kc/boot/kc_main.c4
-rw-r--r--kc/core/cpu/cpu.c3
-rw-r--r--kc/core/cpu/exceptions.h2
-rw-r--r--kc/core/kc_main.c2
-rw-r--r--kc/core/kprint.h5
-rw-r--r--kc/core/kstdio.c6
-rw-r--r--kc/core/memory.h2
-rw-r--r--kc/core/memory/memory.c2
-rw-r--r--kc/core/memory/page_early.c3
-rw-r--r--kc/core/panic.c3
-rw-r--r--kc/core/pic8259.c3
-rw-r--r--kc/core/pit8253.c3
-rw-r--r--kc/core/task.c4
-rw-r--r--kc/core/vm_tree.c4
-rw-r--r--lib/elf64.c3
-rw-r--r--lib/kprintf.c2
-rw-r--r--lib/string.c2
-rw-r--r--loader/main_efi.c5
22 files changed, 46 insertions, 28 deletions
diff --git a/lib/elf.h b/api/lib/elf.h
index 05d25bc..05d25bc 100644
--- a/lib/elf.h
+++ b/api/lib/elf.h
diff --git a/lib/kstdio.h b/api/lib/kstdio.h
index d3615f1..80e47cc 100644
--- a/lib/kstdio.h
+++ b/api/lib/kstdio.h
@@ -1,6 +1,6 @@
#pragma once
-#include <sophialib.h>
+#include <lib/kstring.h>
#include <stdarg.h>
diff --git a/lib/sophialib.h b/api/lib/kstring.h
index c28e17c..c28e17c 100644
--- a/lib/sophialib.h
+++ b/api/lib/kstring.h
diff --git a/api/lib/sophialib.h b/api/lib/sophialib.h
new file mode 100644
index 0000000..c28e17c
--- /dev/null
+++ b/api/lib/sophialib.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <stddef.h>
+
+void *memcpy(void *dest, const void *src, size_t size);
+void *memmove(void *dest, const void *src, size_t size);
+void *memset(void *dest, int val, size_t size);
+int memcmp(const void *str1, const void *str2, size_t count);
+size_t strlen(const char *s);
+unsigned long long strtoull(
+ const char *restrict begin,
+ char **restrict end,
+ int base);
+
diff --git a/kc/boot/kc_main.c b/kc/boot/kc_main.c
index ca4ba8b..4d8cef9 100644
--- a/kc/boot/kc_main.c
+++ b/kc/boot/kc_main.c
@@ -7,11 +7,11 @@
#include <loader/efi/shim.h>
#include <kernel/entry.h>
#include <kernel/memory/range.h>
-#include <sophialib.h>
#include <stdbool.h>
-#include "../lib/elf.h"
+#include <lib/kstring.h>
+#include <lib/elf.h>
#define KERNEL_IMAGE_BASE 0xffffffff80000000
#define OBJECT_SPACE_SIZE 131072
diff --git a/kc/core/cpu/cpu.c b/kc/core/cpu/cpu.c
index f0e7844..a979336 100644
--- a/kc/core/cpu/cpu.c
+++ b/kc/core/cpu/cpu.c
@@ -1,6 +1,5 @@
#include "cpu.h"
#include "exceptions.h"
-#include "kprint.h"
#include "panic.h"
#include "msr.h"
#include "task.h"
@@ -10,6 +9,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <lib/kstdio.h>
+
#define GDT_ENTRIES 16
#define IDT_ENTRIES 256
diff --git a/kc/core/cpu/exceptions.h b/kc/core/cpu/exceptions.h
index 8f7add2..7babb65 100644
--- a/kc/core/cpu/exceptions.h
+++ b/kc/core/cpu/exceptions.h
@@ -21,7 +21,7 @@
#ifndef __ASSEMBLER__
-#include "kprint.h"
+#include <lib/kstdio.h>
struct isr_context_param_regs
{
diff --git a/kc/core/kc_main.c b/kc/core/kc_main.c
index 02b6302..443a6aa 100644
--- a/kc/core/kc_main.c
+++ b/kc/core/kc_main.c
@@ -1,6 +1,5 @@
#include "cpu.h"
#include "serial.h"
-#include "kprint.h"
#include "memory.h"
#include "panic.h"
#include "task.h"
@@ -9,6 +8,7 @@
#include "cpu/irq.h"
#include <kernel/entry.h>
+#include <lib/kstdio.h>
#include <stdbool.h>
#include <stddef.h>
diff --git a/kc/core/kprint.h b/kc/core/kprint.h
deleted file mode 100644
index d023799..0000000
--- a/kc/core/kprint.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#include <kstdio.h>
-
-
diff --git a/kc/core/kstdio.c b/kc/core/kstdio.c
index fdb52b7..1d0bfa9 100644
--- a/kc/core/kstdio.c
+++ b/kc/core/kstdio.c
@@ -1,11 +1,11 @@
-#include "kprint.h"
#include "serial.h"
-#include <sophialib.h>
-
#include <stdint.h>
#include <stdbool.h>
+#include <lib/kstdio.h>
+#include <lib/kstring.h>
+
FILE *kstdout;
int kfputc(int c, FILE *f)
diff --git a/kc/core/memory.h b/kc/core/memory.h
index a587d56..1303a99 100644
--- a/kc/core/memory.h
+++ b/kc/core/memory.h
@@ -4,7 +4,7 @@
#include <kernel/memory/paging.h>
#include <kernel/memory/range.h>
-#include <sophialib.h>
+#include <lib/kstring.h>
#include <core/memory.h>
diff --git a/kc/core/memory/memory.c b/kc/core/memory/memory.c
index df48271..06c2942 100644
--- a/kc/core/memory/memory.c
+++ b/kc/core/memory/memory.c
@@ -11,7 +11,6 @@
#include "page_stack.h"
#include "memory.h"
-#include "kprint.h"
#include "panic.h"
#include "vm_object.h"
#include "cpu/mmu.h"
@@ -21,6 +20,7 @@
#include <kc.h>
#include <core/memory.h>
+#include <lib/kstdio.h>
#define align_next(x, a) (x + a - 1) & ~(a - 1)
diff --git a/kc/core/memory/page_early.c b/kc/core/memory/page_early.c
index 7f1d0eb..933f01b 100644
--- a/kc/core/memory/page_early.c
+++ b/kc/core/memory/page_early.c
@@ -1,7 +1,8 @@
#include "page_early.h"
-#include "kprint.h"
#include "panic.h"
+#include <lib/kstdio.h>
+
static struct page_early_state
{
struct memory_range *first;
diff --git a/kc/core/panic.c b/kc/core/panic.c
index 2f46a6a..7844487 100644
--- a/kc/core/panic.c
+++ b/kc/core/panic.c
@@ -1,5 +1,6 @@
#include "panic.h"
-#include "kprint.h"
+
+#include <lib/kstdio.h>
#include <stdbool.h>
diff --git a/kc/core/pic8259.c b/kc/core/pic8259.c
index 2c85e4d..bbcffc8 100644
--- a/kc/core/pic8259.c
+++ b/kc/core/pic8259.c
@@ -1,10 +1,11 @@
#include "pic8259.h"
#include "cpu.h"
#include "port.h"
-#include "kprint.h"
#include <stdbool.h>
+#include <lib/kstdio.h>
+
#define ICW1_ICW4 0x1
#define ICW1_SINGLE 0x2
#define ICW1_INTERVAL4 0x4
diff --git a/kc/core/pit8253.c b/kc/core/pit8253.c
index 5653eb9..360808f 100644
--- a/kc/core/pit8253.c
+++ b/kc/core/pit8253.c
@@ -1,11 +1,12 @@
#include "pit8253.h"
#include "pic8259.h"
#include "port.h"
-#include "kprint.h"
#include "memory.h"
#include <stdatomic.h>
+#include <lib/kstdio.h>
+
#define PIT8253_DATA0 0x40
#define PIT8253_CMD 0x43
diff --git a/kc/core/task.c b/kc/core/task.c
index 5e55073..df0c03e 100644
--- a/kc/core/task.c
+++ b/kc/core/task.c
@@ -3,7 +3,6 @@
#include "memory.h"
#include "panic.h"
#include "cpu.h"
-#include "kprint.h"
#include "cpu/irq.h"
#include "cpu/mmu.h"
#include "pit8253.h"
@@ -11,6 +10,9 @@
#include <stdatomic.h>
#include <stdbool.h>
+#include <lib/elf.h>
+#include <lib/kstdio.h>
+
static const size_t INTERRUPT_STACK_SIZE = 4096;
static const size_t THREAD_SIZE = 16834;
diff --git a/kc/core/vm_tree.c b/kc/core/vm_tree.c
index 88a4be1..dd3667e 100644
--- a/kc/core/vm_tree.c
+++ b/kc/core/vm_tree.c
@@ -30,9 +30,9 @@
#include "vm_tree.h"
#include "panic.h"
-#include "kprint.h"
-#include <sophialib.h>
+#include <lib/kstdio.h>
+#include <lib/kstring.h>
#define assert(expr)
diff --git a/lib/elf64.c b/lib/elf64.c
index 2dee395..bae408a 100644
--- a/lib/elf64.c
+++ b/lib/elf64.c
@@ -1,4 +1,5 @@
-#include "elf.h"
+#include <stdbool.h>
+#include <lib/elf.h>
bool elf64_validate(Elf64_Ehdr *ehdr, unsigned type, unsigned machine)
{
diff --git a/lib/kprintf.c b/lib/kprintf.c
index 18ae42c..3d803f6 100644
--- a/lib/kprintf.c
+++ b/lib/kprintf.c
@@ -1,4 +1,4 @@
-#include <kstdio.h>
+#include <lib/kstdio.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/lib/string.c b/lib/string.c
index 3d3f4a1..5d4efb7 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -1,4 +1,4 @@
-#include <sophialib.h>
+#include <lib/kstring.h>
size_t strlen(const char *s)
{
diff --git a/loader/main_efi.c b/loader/main_efi.c
index 131c7e4..e49fad6 100644
--- a/loader/main_efi.c
+++ b/loader/main_efi.c
@@ -5,8 +5,9 @@
#include <efi/types.h>
#include <efi/error.h>
-#include "elf.h"
-#include "kstdio.h"
+#include <lib/elf.h>
+#include <lib/kstdio.h>
+#include <lib/kstring.h>
FILE *kstdout;
FILE *kstderr;