aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-06 21:07:35 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-06 21:07:35 +0300
commit70afa4184544d244d804713fdee5836f4f20a9fe (patch)
treea7ca3f332d9bec3e1dc337c8c2d7515dfd0f4f14 /arch
parent9c0f26d26366ff7def20d5be6aff5e0f93976ad6 (diff)
downloadkmi-70afa4184544d244d804713fdee5836f4f20a9fe.tar.gz
kmi-70afa4184544d244d804713fdee5836f4f20a9fe.zip
remove some unused macros
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv64/conf/init-link.S41
-rw-r--r--arch/riscv64/conf/kernel-link.S9
-rw-r--r--arch/riscv64/config.h23
-rw-r--r--arch/riscv64/kernel/start.S1
4 files changed, 7 insertions, 67 deletions
diff --git a/arch/riscv64/conf/init-link.S b/arch/riscv64/conf/init-link.S
deleted file mode 100644
index 2f48814..0000000
--- a/arch/riscv64/conf/init-link.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: copyleft-next-0.3.1 */
-/* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */
-
-OUTPUT_ARCH(riscv)
-ENTRY(_start)
-
-SECTIONS {
- /* slight hack, the binary is position independent code but technically
- not a PIE, so avoid globals and just add the load address to external
- addresses. */
- __init_start = 0;
-
- /* objcopy only copies these three sections (as far as I'm aware) into the
- produced binary, so __init_end should point to the correct location in the
- final binary
- */
- .text ALIGN(4K) : AT(0) {
- *(.init*)
- *(.text*);
- }
-
- .rodata : {
- *(.rodata*)
- }
-
- .data : {
- *(.data*)
- }
-
- .bss : {
- *(.sbss*) *(.bss*) *(COMMON)
- }
-
- __kernel = .;
- __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 d93b642..1a0d42f 100644
--- a/arch/riscv64/conf/kernel-link.S
+++ b/arch/riscv64/conf/kernel-link.S
@@ -5,9 +5,14 @@ OUTPUT_ARCH(riscv)
ENTRY(main)
SECTIONS {
- . = ABSOLUTE(VM_KERN);
+ /* This is apparently necessary. I *think* it is to tell the linker that
+ * the kernel should be able to run in the bottom half of the address
+ * space, but I don't know for sure and this feels like a fairly major
+ * hack.
+ * @todo look into this further.
+ */
+ . = ABSOLUTE(VM_DMAP);
__kernel_start = .;
-
.text ALIGN(4K) : AT(0) {
*(.kernel.start);
*(.text*);
diff --git a/arch/riscv64/config.h b/arch/riscv64/config.h
index aefcc8f..2c513a5 100644
--- a/arch/riscv64/config.h
+++ b/arch/riscv64/config.h
@@ -26,34 +26,12 @@
/* don't touch >:( */
-/**
- * How much space to reserve for possible firmware region.
- * Assumed to be at start of RAM.
- */
-#define FW_MAX_SIZE (SZ_2M)
-
-/** Maximum size of the kernel proper. Largely arbitrary. */
-/** \todo UBSAN is getting pretty close to this limit, should it be raised? */
-#define PM_KERN_SIZE (SZ_256K)
-
-/** Virtual memory stack base. In this case, right after the kernel. */
-#define VM_STACK_BASE (VM_KERN + PM_KERN_SIZE)
-
-/** Size of virtual memory stack. */
-#define VM_STACK_SIZE (SZ_4K)
-
-/** Top of virtual memory stack. */
-#define VM_STACK_TOP (VM_STACK_BASE + VM_STACK_SIZE)
-
#if __riscv_xlen == 64
/* 64bit */
/** Direct map offset. */
#define VM_DMAP (0xffffffc000000000) /* testing for now */
-/** Virtual address of kernel proper inside direct mapping. */
-#define VM_KERN (VM_DMAP + FW_MAX_SIZE)
-
/** Page reserved for kernel I/O. */
#define IO_PAGE 511UL
@@ -92,7 +70,6 @@
/** \todo figure this stuff out */
#define VM_DMAP 0x80000000 /* works on qemu at least */
-#define VM_KERN (VM_DMAP + FW_MAX_SIZE)
#define IO_PAGE 1023UL
#define KSTART_PAGE 512UL
diff --git a/arch/riscv64/kernel/start.S b/arch/riscv64/kernel/start.S
index 4978cc0..73a442e 100644
--- a/arch/riscv64/kernel/start.S
+++ b/arch/riscv64/kernel/start.S
@@ -1,7 +1,6 @@
#if GENERIC_UBOOT
# define MAIN main_go
#else
-# define LOAD_REG a1
# define MAIN main
#endif