aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/conf
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/conf
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/conf')
-rw-r--r--arch/riscv64/conf/init-link.S13
-rw-r--r--arch/riscv64/conf/kmi.its4
2 files changed, 11 insertions, 6 deletions
diff --git a/arch/riscv64/conf/init-link.S b/arch/riscv64/conf/init-link.S
index 600304f..0933fbb 100644
--- a/arch/riscv64/conf/init-link.S
+++ b/arch/riscv64/conf/init-link.S
@@ -5,11 +5,13 @@ OUTPUT_ARCH(riscv)
ENTRY(_start)
SECTIONS {
- . = ABSOLUTE(PM_KERN_BASE);
- __init_start = .;
+ /* 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
- produces binary, so __init_end should point to the correct location in the
+ produced binary, so __init_end should point to the correct location in the
final binary
*/
.text ALIGN(4K) : AT(0) {
@@ -29,7 +31,10 @@ SECTIONS {
*(.sbss*) *(.bss*) *(COMMON)
}
- __init_end = . ;
+ .top : {
+ *(.top*)
+ }
+
__kernel_size = <KERNEL_SIZE>;
.garbage : {
diff --git a/arch/riscv64/conf/kmi.its b/arch/riscv64/conf/kmi.its
index 0494030..768f98b 100644
--- a/arch/riscv64/conf/kmi.its
+++ b/arch/riscv64/conf/kmi.its
@@ -12,8 +12,8 @@
arch = "riscv";
os = "kmi";
compression = "none";
- load = <0x80240000>;
- entry = <0x80240000>;
+ load = <0x80260000>;
+ entry = <0x80260000>;
hash-1 {
algo = "sha1";
};