From owner-freebsd-ppc@FreeBSD.ORG Mon Apr 20 08:18:13 2015 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 965845F9 for ; Mon, 20 Apr 2015 08:18:13 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 262D8AD8 for ; Mon, 20 Apr 2015 08:18:12 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3K8Hvse043732 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 20 Apr 2015 11:17:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3K8Hvse043732 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3K8HuxZ043731; Mon, 20 Apr 2015 11:17:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 20 Apr 2015 11:17:56 +0300 From: Konstantin Belousov To: Justin Hibbits Cc: FreeBSD PowerPC ML Subject: Re: Clearing sbss/bss at bootup Message-ID: <20150420081756.GC2390@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2015 08:18:13 -0000 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 ?