diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-20 23:50:43 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-20 23:50:43 +0000 |
| commit | 6002ec7d841d91d85cc55733c539594c97fc2e30 (patch) | |
| tree | 951daac374219fcf6d49af9195383443e8f468f0 /kc | |
| parent | 0625188d3e925136645f2a99f6280dbf689dc0e2 (diff) | |
moving files around
Diffstat (limited to 'kc')
| -rw-r--r-- | kc/api/core/memory.h | 15 | ||||
| -rw-r--r-- | kc/api/kc.h | 11 | ||||
| -rw-r--r-- | kc/api/lib.h | 10 | ||||
| -rw-r--r-- | kc/boot/Makefile | 2 | ||||
| -rw-r--r-- | kc/core/Makefile | 2 | ||||
| -rw-r--r-- | kc/core/kcc_memory.c | 2 | ||||
| -rw-r--r-- | kc/core/kprint.c | 2 | ||||
| -rw-r--r-- | kc/core/memory.c | 2 | ||||
| -rw-r--r-- | kc/core/memory.h | 2 | ||||
| -rw-r--r-- | kc/defaults.mk | 3 | ||||
| -rw-r--r-- | kc/kc.ld (renamed from kc/component.ld) | 0 | ||||
| -rw-r--r-- | kc/reloc_x86_64.c | 2 |
12 files changed, 45 insertions, 8 deletions
diff --git a/kc/api/core/memory.h b/kc/api/core/memory.h new file mode 100644 index 0000000..b428b15 --- /dev/null +++ b/kc/api/core/memory.h @@ -0,0 +1,15 @@ +/* + * kernel component core - memory management interface + */ +#pragma once + +#include <kc.h> + +#include <stdint.h> + +typedef uint64_t kc_phys_addr; +typedef void * kc_virt_addr; + +kc_phys_addr kcc_page_alloc(void); +void kcc_page_free(kc_phys_addr page); + diff --git a/kc/api/kc.h b/kc/api/kc.h new file mode 100644 index 0000000..c3390b2 --- /dev/null +++ b/kc/api/kc.h @@ -0,0 +1,11 @@ +#pragma once + +extern char kc_image_base; +extern char kc_text_begin; +extern char kc_text_end; +extern char kc_rodata_begin; +extern char kc_data_begin; +extern char kc_data_end; + +#define KC_EXPORT __attribute__((visibility("default"))) + diff --git a/kc/api/lib.h b/kc/api/lib.h new file mode 100644 index 0000000..3bf0eca --- /dev/null +++ b/kc/api/lib.h @@ -0,0 +1,10 @@ +#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); + diff --git a/kc/boot/Makefile b/kc/boot/Makefile index 506c12b..36d069e 100644 --- a/kc/boot/Makefile +++ b/kc/boot/Makefile @@ -7,7 +7,7 @@ VPATH := ../../lib ../ TARGET := efi.os .DEFAULT: $(TARGET) -CPPFLAGS += -I../../api +CPPFLAGS += -I../../api -I ../api OBJS := entry_x86_64.o reloc_x86_64.o kc_main.o elf64.o memcmp.o memcpy.o \ memmove.o memset.o diff --git a/kc/core/Makefile b/kc/core/Makefile index 589616f..6651ca6 100644 --- a/kc/core/Makefile +++ b/kc/core/Makefile @@ -6,7 +6,7 @@ VPATH := ../../lib ../ cpu/ TARGET := kernel.os .DEFAULT: $(TARGET) -CPPFLAGS += -I../../api -I. +CPPFLAGS += -I../../api -I../api -I. CFLAGS += -Wno-unused-const-variable -Wno-unused-function -fvisibility=hidden -g SOBJS := diff --git a/kc/core/kcc_memory.c b/kc/core/kcc_memory.c index 68aa1d4..1f3a813 100644 --- a/kc/core/kcc_memory.c +++ b/kc/core/kcc_memory.c @@ -1,6 +1,6 @@ #include "memory.h" -#include <kc/core/memory.h> +#include <core/memory.h> KC_EXPORT kc_phys_addr kcc_page_alloc(void) diff --git a/kc/core/kprint.c b/kc/core/kprint.c index 5d2fbdc..762f99f 100644 --- a/kc/core/kprint.c +++ b/kc/core/kprint.c @@ -1,7 +1,7 @@ #include "kprint.h" #include "serial.h" -#include <kc/lib.h> +#include <lib.h> #include <stdint.h> #include <stdbool.h> diff --git a/kc/core/memory.c b/kc/core/memory.c index 2dac707..bef6cd2 100644 --- a/kc/core/memory.c +++ b/kc/core/memory.c @@ -7,7 +7,7 @@ #include <stdint.h> -#include <kc/kc.h> +#include <kc.h> /* kernel virtual space guarantees * diff --git a/kc/core/memory.h b/kc/core/memory.h index 5deda81..526d8ca 100644 --- a/kc/core/memory.h +++ b/kc/core/memory.h @@ -1,6 +1,6 @@ #pragma once -#include <kc/lib.h> +#include <lib.h> #include <kernel/entry.h> #include <kernel/memory/paging.h> diff --git a/kc/defaults.mk b/kc/defaults.mk index 4464801..588b9b0 100644 --- a/kc/defaults.mk +++ b/kc/defaults.mk @@ -1,5 +1,6 @@ + LIBDIRS += -L$(dir $(shell $(CC) -print-libgcc-file-name)) -LDSCRIPT := ../component.ld +LDSCRIPT := ../kc.ld LDFLAGS += -z max-page-size=4096 --export-dynamic -pic --no-dynamic-linker \ -z separate-code LOADLIBES := -lgcc diff --git a/kc/component.ld b/kc/kc.ld index dc158f3..dc158f3 100644 --- a/kc/component.ld +++ b/kc/kc.ld diff --git a/kc/reloc_x86_64.c b/kc/reloc_x86_64.c index dfc6df6..c70027f 100644 --- a/kc/reloc_x86_64.c +++ b/kc/reloc_x86_64.c @@ -1,4 +1,4 @@ -#include <kc/kc.h> +#include <kc.h> #include <elf/elf64.h> |
