diff options
| -rw-r--r-- | api/kc/core/memory.h | 15 | ||||
| -rw-r--r-- | api/kc/kc.h (renamed from api/kernel/component.h) | 3 | ||||
| -rw-r--r-- | kc/core/Makefile | 3 | ||||
| -rw-r--r-- | kc/core/kcc_memory.c | 16 | ||||
| -rw-r--r-- | kc/core/memory.c | 2 | ||||
| -rw-r--r-- | kc/reloc_x86_64.c | 2 |
6 files changed, 37 insertions, 4 deletions
diff --git a/api/kc/core/memory.h b/api/kc/core/memory.h new file mode 100644 index 0000000..d6f1cd6 --- /dev/null +++ b/api/kc/core/memory.h @@ -0,0 +1,15 @@ +/* + * kernel component core - memory management interface + */ +#pragma once + +#include <kc/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/api/kernel/component.h b/api/kc/kc.h index d795283..c3390b2 100644 --- a/api/kernel/component.h +++ b/api/kc/kc.h @@ -4,7 +4,8 @@ extern char kc_image_base; extern char kc_text_begin; extern char kc_text_end; extern char kc_rodata_begin; -extern char kc_rodata_end; extern char kc_data_begin; extern char kc_data_end; +#define KC_EXPORT __attribute__((visibility("default"))) + diff --git a/kc/core/Makefile b/kc/core/Makefile index 7458ba5..b0f4035 100644 --- a/kc/core/Makefile +++ b/kc/core/Makefile @@ -12,7 +12,8 @@ CFLAGS += -Wno-unused-const-variable -Wno-unused-function -fvisibility=hidden -g SOBJS := GOBJS := entry_x86_64.o reloc_x86_64.o kprint.o serial.o port.o \ kc_main.o main.o memory.o memset.o memcpy.o memmove.o memcmp.o cpu.o \ - vm_tree.o exceptions.o panic.o msr.o task.o cpu_task.o + vm_tree.o exceptions.o panic.o msr.o task.o cpu_task.o \ + kcc_memory.o IOBJS := # __attribute__((interrupt)) requires -mgeneral-regs-only diff --git a/kc/core/kcc_memory.c b/kc/core/kcc_memory.c new file mode 100644 index 0000000..68aa1d4 --- /dev/null +++ b/kc/core/kcc_memory.c @@ -0,0 +1,16 @@ +#include "memory.h" + +#include <kc/core/memory.h> + +KC_EXPORT +kc_phys_addr kcc_page_alloc(void) +{ + return page_alloc(); +} + +KC_EXPORT +void kcc_page_free(kc_phys_addr page) +{ + page_free(page); +} + diff --git a/kc/core/memory.c b/kc/core/memory.c index 2d5dd75..634c3b3 100644 --- a/kc/core/memory.c +++ b/kc/core/memory.c @@ -6,7 +6,7 @@ #include <stdint.h> -#include <kernel/component.h> +#include <kc/kc.h> /* kernel virtual space guarantees * diff --git a/kc/reloc_x86_64.c b/kc/reloc_x86_64.c index 0204700..dfc6df6 100644 --- a/kc/reloc_x86_64.c +++ b/kc/reloc_x86_64.c @@ -1,4 +1,4 @@ -#include <kernel/component.h> +#include <kc/kc.h> #include <elf/elf64.h> |
