aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/config.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-05-11 22:55:31 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-05-11 22:55:31 +0300
commit27ffa747f36aee9c1d5bbc61395a078238366070 (patch)
treef37c544aaca6bebd1cc146d1eb002483c7cfd474 /arch/riscv64/config.h
parent3109effe7297232e17c1792e63c3a9c7d129a4eb (diff)
downloadkmi-27ffa747f36aee9c1d5bbc61395a078238366070.tar.gz
kmi-27ffa747f36aee9c1d5bbc61395a078238366070.zip
arbitrary load address and RAM base detection
+ Both kind of go hand in hand, made sense to do both at the same time. Some parts feel slightly hacky, the loader works by placing everything on the stack and avoiding global values. Still, seems to work?
Diffstat (limited to 'arch/riscv64/config.h')
-rw-r--r--arch/riscv64/config.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/riscv64/config.h b/arch/riscv64/config.h
index 1d4a6e0..3eb2e72 100644
--- a/arch/riscv64/config.h
+++ b/arch/riscv64/config.h
@@ -22,7 +22,7 @@
/* --- START ARCH USER CONFIG VALUES --- */
/** Physical address to where the OS image will be loaded. */
-#define RAM_BASE 0x80000000
+//#define RAM_BASE 0x80000000
/* --- END ARCH USER CONFIG VALUES --- */
/* don't touch >:( */
@@ -37,20 +37,14 @@
/** \todo UBSAN is getting pretty close to this limit, should it be raised? */
#define PM_KERN_SIZE (SZ_256K)
-/** Physical address to where the kernel proper will be relocated. */
-#define PM_KERN_BASE (RAM_BASE + FW_MAX_SIZE + PM_KERN_SIZE)
+/** Virtual memory stack base. In this case, right after the kernel. */
+#define VM_STACK_BASE (VM_KERN + PM_KERN_SIZE)
-/** Highest allowed physical address where kernel stuff may lie. */
-#define PM_KERN_TOP (PM_KERN_BASE + PM_KERN_SIZE)
+/** Size of virtual memory stack. */
+#define VM_STACK_SIZE (SZ_4K)
-/** Physical memory stack base. In this case, right after the kernel. */
-#define PM_STACK_BASE (PM_KERN_BASE + PM_KERN_SIZE)
-
-/** Size of physical memory stack. */
-#define PM_STACK_SIZE (SZ_256K)
-
-/** Top of physical memory stack. */
-#define PM_STACK_TOP (PM_STACK_BASE + PM_STACK_SIZE)
+/** Top of virtual memory stack. */
+#define VM_STACK_TOP (VM_STACK_BASE + VM_STACK_SIZE)
#if defined(riscv64)
/* 64bit */
@@ -67,7 +61,11 @@
/** Direct mapping starts from this page. */
#define KSTART_PAGE 256UL
-/** The RPC stack page. */
+/**
+ * The RPC stack page.
+ * @todo this should be page before KSTART, but currently
+ * RPC_STACK_TOP is too low (why? was there a reason to place it so low?) and overlaps.
+ */
#define CSTACK_PAGE 248UL
/** User virtual memory space start. */