From eb6a12e18d45879ec383921f0c7378120b71d159 Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Wed, 17 Dec 2025 14:13:08 +0700 Subject: Linker script rework `memory.ld` is a architecture-dependent ld config provides some general symbols which every `memory.ld` config must assign and memory regions associated with each output section. 'linker.ld' config file presents segments configuration. Multiboot section filling move in the 'linker.ld' file. Recommendation for further patches: controlled logic implementation for multiboot version and header/entries in build configuration tool (CMake or make). For instance, multiboot version and video mode selection through variable passing in build system: `cmake ... -DMULTIBOOT_VERSION=2 -DMULTIBOOT_VIDEO_MODE=TEXT_VIDEO_MODE` or 'export MULTIBOOT_VERSION=2; export MULTIBOOT_VIDEO_MODE=TEXT_VIDEO_MODE'. Then build system do proper filling of `.multiboot` section depends on passing variables. Signed-off-by: Alexey Gavrilov --- kernel/boot.s | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'kernel/boot.s') diff --git a/kernel/boot.s b/kernel/boot.s index 534beb6..281e1ca 100644 --- a/kernel/boot.s +++ b/kernel/boot.s @@ -1,36 +1,11 @@ -MBFLAGS equ 0 -MAGIC equ 0x1BADB002 -CHECKSUM equ -(MAGIC + MBFLAGS) - - section .multiboot -align 4 - dd MAGIC - dd MBFLAGS - dd CHECKSUM - -section .bss -resb 512 -align 16 -; align 16 bytes according to the System V ABI standard -; Stack space -stack_bottom: -resb 16384 ; 16KiB -stack_top: - section .text extern main +extern _estack global _start:function (_start.end - _start) _start: - mov esp, stack_top + mov esp, _estack call main cli .hang: hlt jmp .hang .end: - -section .kheap -kheap_top: -; Kernel heap space -; Change this value together Kheap::size varibale (mem/Kheap.h file) -resb 4096 -kheap_bottom: -- cgit v1.2.3