Separate BSS section, cleared manually at runtime.

This commit is contained in:
Thomas Oltmann 2025-07-17 07:09:21 +02:00
parent ac53cb9cfc
commit 65c9bf56f5
3 changed files with 15 additions and 3 deletions

View file

@ -11,7 +11,7 @@ config.mk: | config.default.mk
cp config.default.mk $@
boot.bin: boot.elf
objcopy -O binary --only-section=.text boot.elf $@
objcopy -O binary -j .text -j .data boot.elf $@
boot.elf: lboot.o loader.o fernlader.ld
$(LD) $(LDFLAGS) -o $@ lboot.o loader.o

View file

@ -6,9 +6,15 @@ SECTIONS {
.text 0x7C00: {
lboot.o(.text)
*(.text, .rodata*)
} :all
.data : {
*(.data)
*(.bss, COMMON)
. = ALIGN(4K);
lboot.o(.data.bootboot)
} :all
_bss_start = .;
.bss (NOLOAD) : {
*(.bss, COMMON)
} :all
_bss_end = .;
}

View file

@ -57,6 +57,12 @@ _start: cli
mov %ax, %ds
mov %ax, %es
mov $_bss_start, %di
mov $_bss_end, %cx
sub %di, %cx
xor %al, %al
rep stosb
call init_com1
mov $msg_start, %si
@ -122,7 +128,7 @@ _start: cli
mov $msg_long, %si
call print
jmp hang // REMOVE ME
//jmp hang // REMOVE ME
call long
jmp hang