startup: clear bss section

iBoot does this for us, but this is for the benefit of chainload.py and
other dump loaders that may not.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-01-30 03:02:32 +09:00
parent b673db78c3
commit dc2b7b3bb4
2 changed files with 6 additions and 0 deletions

View file

@ -159,11 +159,13 @@ SECTIONS {
_file_end = .;
} :data
.bss : ALIGN(0x4000) {
_bss_start = .;
*(.bss)
*(.bss.*)
*(.dynbss)
*(COMMON)
. = ALIGN(0x4000);
_bss_end = .;
PROVIDE(_stack_top = .);
. += _stack_size;
PROVIDE(_stack_bot = .);

View file

@ -20,6 +20,9 @@ struct rela_entry {
void debug_putc(char c);
void m1n1_main(void);
extern char _bss_start[0];
extern char _bss_end[0];
#define R_AARCH64_RELATIVE 1027
void apply_rela(uint64_t base, struct rela_entry *rela_start, struct rela_entry *rela_end)
@ -67,6 +70,7 @@ void dump_boot_args(struct boot_args *ba)
void _start_c(void *boot_args, void *base)
{
UNUSED(base);
memset64(_bss_start, 0, _bss_end - _bss_start);
uart_putchar('s');
uart_init();
uart_putchar('c');