aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv64/conf/init-link.S5
-rw-r--r--arch/riscv64/conf/kernel-link.S5
-rw-r--r--arch/riscv64/config.h4
-rw-r--r--arch/riscv64/init/init.c15
4 files changed, 25 insertions, 4 deletions
diff --git a/arch/riscv64/conf/init-link.S b/arch/riscv64/conf/init-link.S
index ac7f858..f827245 100644
--- a/arch/riscv64/conf/init-link.S
+++ b/arch/riscv64/conf/init-link.S
@@ -31,4 +31,9 @@ SECTIONS {
__init_end = . ;
__kernel_size = <KERNEL_SIZE>;
+
+ .garbage : {
+ *(.note*)
+ *(.riscv.attributes)
+ }
}
diff --git a/arch/riscv64/conf/kernel-link.S b/arch/riscv64/conf/kernel-link.S
index 5673a64..2f000c9 100644
--- a/arch/riscv64/conf/kernel-link.S
+++ b/arch/riscv64/conf/kernel-link.S
@@ -26,4 +26,9 @@ SECTIONS {
}
__kernel_end = .;
+
+ .garbage : {
+ *(.note*)
+ *(.riscv.attributes)
+ }
}
diff --git a/arch/riscv64/config.h b/arch/riscv64/config.h
index 5ea5482..7606e38 100644
--- a/arch/riscv64/config.h
+++ b/arch/riscv64/config.h
@@ -98,7 +98,7 @@
#define UVMEM_START (SZ_4K)
#define UVMEM_END (SZ_4G - SZ_8M)
-#define PROC_STACK_TOP (SZ_4G)
-#define PROC_STACK_BASE (SZ_4G - SZ_8M)
+#define RPC_STACK_TOP (SZ_4G)
+#define RPC_STACK_BASE (SZ_4G - SZ_8M)
#endif
#endif /* APOS_RISCV_CONFIG_H */
diff --git a/arch/riscv64/init/init.c b/arch/riscv64/init/init.c
index c91d192..0ea1f37 100644
--- a/arch/riscv64/init/init.c
+++ b/arch/riscv64/init/init.c
@@ -42,19 +42,30 @@ static void init_bootmem()
* @todo Allocate root_branch statically? */
root_branch = (struct vmem *)align_up(top, SZ_4K);
+#if defined(riscv64)
+ const size_t top_size = SZ_1G;
+#else
+ const size_t top_size = SZ_4M;
+#endif
+
/* direct mapping (temp) */
for (size_t i = 0; i < CSTACK_PAGE; ++i)
- root_branch->leaf[i] = (struct vmem *)to_pte(SZ_1G * i, flags);
+ root_branch->leaf[i] = (struct vmem *)to_pte(top_size * i, flags);
/* kernel (also sort of direct mapping) */
flags |= VM_G;
for (size_t i = KSTART_PAGE; i < IO_PAGE; ++i)
root_branch->leaf[i] = (struct vmem *)to_pte(
- RAM_BASE + SZ_1G * (i - 256), flags);
+ RAM_BASE + top_size * (i - KSTART_PAGE), flags);
/* kernel IO, map to 0 for now, will be updated in the future */
root_branch->leaf[IO_PAGE] = (struct vmem *)to_pte(0, flags);
+#if defined(riscv64)
+ const uintmax_t mode = SATP_MODE_Sv39;
+#else
+ const uintmax_t mode = SATP_MODE_Sv32;
+#endif
csr_write(CSR_SATP, SATP_MODE_Sv39 | ((uintptr_t)root_branch >> 12));
}