From 9972f8cb3640c292d0a14b23cc87e3de153d083f Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Tue, 22 Aug 2023 19:27:09 -0700 Subject: [PATCH] Update order for kernel segments --- sw/bios/boot2.s | 4 +++- sw/kernel/boot.s | 2 +- sw/kernel/link.ld | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sw/bios/boot2.s b/sw/bios/boot2.s index 3d06d98..9e160a0 100644 --- a/sw/bios/boot2.s +++ b/sw/bios/boot2.s @@ -96,7 +96,9 @@ _start: ldx #>_good jsr _cputs ; otherwise continue on -@3: jmp @3 +; Now we need to load it into memory. It cannot be just loaded into memory, +; I think if we have startup be first in the linker script it will always be +; at the beginning? then we can just copy the text/data segments as is... ; parse root directory for kernel.o65 ; load first data cluster (we know this is root.) diff --git a/sw/kernel/boot.s b/sw/kernel/boot.s index 3520358..1d86ca1 100644 --- a/sw/kernel/boot.s +++ b/sw/kernel/boot.s @@ -17,7 +17,7 @@ ; --------------------------------------------------------------------------- ; Place the startup code in a special segment -.segment "STARTUP" +.segment "CODE" ; --------------------------------------------------------------------------- ; A little light 6502 housekeeping diff --git a/sw/kernel/link.ld b/sw/kernel/link.ld index fd1f6ca..8348fad 100644 --- a/sw/kernel/link.ld +++ b/sw/kernel/link.ld @@ -9,14 +9,14 @@ MEMORY } SEGMENTS { - ZEROPAGE: load = ZP, type = zp, define = yes; + ZEROPAGE: load = ZP, type = zp, define = yes; + STARTUP: load = KERNEL, type = ro; + CODE: load = KERNEL, type = ro; + ONCE: load = KERNEL, type = ro, optional = yes; DATA: load = KERNEL, type = rw, define = yes; BSS: load = KERNEL, type = rw, define = yes; HEAP: load = KERNEL, type = rw, define = yes, optional = yes; - STARTUP: load = KERNEL, type = ro; - ONCE: load = KERNEL, type = ro, optional = yes; - CODE: load = ROM, type = ro; - RODATA: load = ROM, type = ro; + RODATA: load = KERNEL, type = ro; VECTORS: load = ROM, type = ro, start = $FFFA; }