Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 2015 11:17:56 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Justin Hibbits <jrh29@alumni.cwru.edu>
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: Clearing sbss/bss at bootup
Message-ID:  <20150420081756.GC2390@kib.kiev.ua>
In-Reply-To: <CAHSQbTBkD4ddpq4SDM_-jpqE2f505bgJ7F9-Vkr9O58NEL0jbQ@mail.gmail.com>
References:  <CAHSQbTBkD4ddpq4SDM_-jpqE2f505bgJ7F9-Vkr9O58NEL0jbQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 19, 2015 at 10:12:05PM -0700, Justin Hibbits wrote:
> Been looking at bootup issues on the e500, and many of the issues I
> see are caused by static variables not being initialized to 0 early
> enough.  The code doesn't bzero() the bss/sbss until pretty late in
> bootup.  Is there a reason why that is?  Why can't the bss be cleared
> immediately?  Do loaders pass in data at addresses that may overlap
> the bss?

I thought that bss is cleared by ELF loader code from the boot loader.
I.e. the kernel runs from the very start with the assumption that bss
is correct.

See e.g. line 427 in sys/boot/common/load_elf.c for the shared object-style
kernel/modules, and line 288 in sys/boot/common/load_elf_obj.c for
the relocatable objects.

Does your platform use FreeBSD loader ?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150420081756.GC2390>