Separate BSS section, cleared manually at runtime.
This commit is contained in:
parent
ac53cb9cfc
commit
65c9bf56f5
3 changed files with 15 additions and 3 deletions
2
Makefile
2
Makefile
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = .;
|
||||
}
|
||||
|
|
|
|||
8
lboot.S
8
lboot.S
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue