aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-01-07 20:21:39 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-01-07 20:21:39 +0200
commitadeac5a8ce9c06ad589d2dd6ee137071ba865d0c (patch)
treec90528efb341f6d845aa94a0718d57f9e4e2d7be
parentc4bee44adf8e8377b2d8d7e8bcd83277b690821c (diff)
downloadkmi-adeac5a8ce9c06ad589d2dd6ee137071ba865d0c.tar.gz
kmi-adeac5a8ce9c06ad589d2dd6ee137071ba865d0c.zip
Modified pmem configuration handling
-rw-r--r--TODO.txt5
-rw-r--r--arch/riscv64/include/pmem.h1
-rw-r--r--arch/riscv64/kernel/pmem.c6
-rw-r--r--common/pmem.c4
-rw-r--r--include/apos/mem.h2
-rw-r--r--include/apos/pmem.h5
-rw-r--r--include/arch/pmem.h11
7 files changed, 23 insertions, 11 deletions
diff --git a/TODO.txt b/TODO.txt
index 25e90d8..8492ade 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -35,7 +35,7 @@ worh doing anything to.
!!! CURRENT:
+ Separate vmem and devmem to have a common 'backend', like mem_nodes or
-whatever, would probably make it a bit more clean-feeling.
+whatever, would probably make it a bit more clean-feeling. (x)
+ Add in interrupt handling and start testing jumping back and forth.
+ Add in better tcb handling, mainly creating linked lists with all threads
under a common process ID.
@@ -46,3 +46,6 @@ under a common process ID.
used address of the guest address space and only map so many pages, which could
be better for cache locality.
+ Assert? Not sure how to handle a kernel panic at the moment, I guess just die?
++ Add in more logging etc. dumbass
++ More functions, less macros? sometimes helpful in gdb, maybe also for kernel
+binary size?
diff --git a/arch/riscv64/include/pmem.h b/arch/riscv64/include/pmem.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/riscv64/include/pmem.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/riscv64/kernel/pmem.c b/arch/riscv64/kernel/pmem.c
index 45b8eeb..404329c 100644
--- a/arch/riscv64/kernel/pmem.c
+++ b/arch/riscv64/kernel/pmem.c
@@ -1,6 +1,6 @@
-#include <apos/pmem.h>
+#include <arch/pmem.h>
-int arch_pmem_conf(void *fdt, size_t *max_order, size_t *base_bits, size_t bits[ORDERS_NUM])
+stat_t stat_pmem_conf(void *fdt, size_t *max_order, size_t *base_bits, size_t bits[NUM_ORDERS])
{
UNUSED(fdt);
@@ -11,5 +11,5 @@ int arch_pmem_conf(void *fdt, size_t *max_order, size_t *base_bits, size_t bits[
for(size_t i = 0; i <= *max_order; ++i)
bits[i] = 9;
- return 0;
+ return OK;
}
diff --git a/common/pmem.c b/common/pmem.c
index 04b771e..4c965cf 100644
--- a/common/pmem.c
+++ b/common/pmem.c
@@ -409,8 +409,8 @@ void init_pmem(void *fdt)
{
size_t max_order = 0;
size_t base_bits = 0;
- size_t bits[ORDERS_NUM] = {0};
- arch_pmem_conf(fdt, &max_order, &base_bits, bits);
+ size_t bits[NUM_ORDERS] = {0};
+ stat_pmem_conf(fdt, &max_order, &base_bits, bits);
init_mem(max_order, bits, base_bits);
pm_t ram_size = __get_ramtop(fdt) - RAM_BASE;
diff --git a/include/apos/mem.h b/include/apos/mem.h
index 61528df..d995b04 100644
--- a/include/apos/mem.h
+++ b/include/apos/mem.h
@@ -44,7 +44,7 @@ extern size_t __mm_sizes[10];
extern size_t __mm_page_shift;
extern size_t __mm_max_order;
-#define ORDERS_NUM 10
+#define NUM_ORDERS 10
enum mm_order {
MM_O0,
MM_O1,
diff --git a/include/apos/pmem.h b/include/apos/pmem.h
index 0f58e1c..2ff817d 100644
--- a/include/apos/pmem.h
+++ b/include/apos/pmem.h
@@ -3,11 +3,8 @@
#include <apos/mem.h>
#include <apos/types.h>
+#include <arch/pmem.h>
-/* arch */
-int arch_pmem_conf(void *fdt, size_t *max_order, size_t *base_bits, size_t bits[ORDERS_NUM]);
-
-/* common */
void update_pmap(pm_t offset);
void free_page(enum mm_order order, pm_t paddr);
void mark_used(enum mm_order order, pm_t paddr);
diff --git a/include/arch/pmem.h b/include/arch/pmem.h
new file mode 100644
index 0000000..1772b36
--- /dev/null
+++ b/include/arch/pmem.h
@@ -0,0 +1,11 @@
+#ifndef APOS_ARCH_PMEM_H
+#define APOS_ARCH_PMEM_H
+
+#include <apos/mem.h> /* NUM_ORDERS */
+#include <apos/types.h>
+#include <pmem.h>
+
+stat_t stat_pmem_conf(void *fdt, size_t *max_order,
+ size_t *base_bits, size_t bits[NUM_ORDERS]);
+
+#endif /* APOS_ARCH_PMEM_H */