Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Apr 2015 20:18:45 -0700
From:      Justin Hibbits <jrh29@po.cwru.edu>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, Justin Hibbits <jrh29@alumni.cwru.edu>
Subject:   Re: Clearing sbss/bss at bootup
Message-ID:  <CAM5YCnb-NgTS84P-Fzg76cj-Q3Bfw5eEs1L0Szk-D5Pp26%2B2Yw@mail.gmail.com>
In-Reply-To: <20150420081756.GC2390@kib.kiev.ua>
References:  <CAHSQbTBkD4ddpq4SDM_-jpqE2f505bgJ7F9-Vkr9O58NEL0jbQ@mail.gmail.com> <20150420081756.GC2390@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Apr 20, 2015 4:38 AM, "Konstantin Belousov" <kostikbel@gmail.com> wrote:
>
> 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 ?

No, the RouterBoard uses a custom loader. It doesn't seem to have any
guarantees of initialization.

- Justin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM5YCnb-NgTS84P-Fzg76cj-Q3Bfw5eEs1L0Szk-D5Pp26%2B2Yw>