Skip to content

Commit

Permalink
crt0: fix clearing sbss/bss section
Browse files Browse the repository at this point in the history
  • Loading branch information
rickgaiser committed Mar 6, 2024
1 parent d344db8 commit 5d07b74
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions ee/startup/src/crt0.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,6 @@ static struct sargs_start *args_start;
void __start(struct sargs_start *pargs)
{
asm volatile(
"# Clear bss area \n"
".set noat \n"
"la $2, _fbss \n"
"la $3, _end \n"
"1: \n"
"sltu $1, $2, $3 \n"
"beq $1, $0, 2f \n"
"nop \n"
"sq $0, ($2) \n"
"addiu $2, $2, 16 \n"
"j 1b \n"
"nop \n"
"2: \n"
" \n"
"# Save first argument \n"
"la $2, %0 \n"
"sw $4, ($2) \n"
Expand All @@ -74,7 +60,6 @@ void __start(struct sargs_start *pargs)
" \n"
"# Jump to _main \n"
"j %2 \n"
".set at \n"
: /* No outputs. */
: "R"(args_start), "R"(args), "Csy"(_main));
}
Expand All @@ -87,6 +72,9 @@ static void _main()
int retval;
struct sargs *pa;

// Clear sbss and bss secions
memset(_fbss, 0, _end - _fbss);

// initialize heap
SetupHeap(&_end, (int)&_heap_size);

Expand Down

0 comments on commit 5d07b74

Please sign in to comment.