From owner-freebsd-ppc@FreeBSD.ORG Sun Apr 26 03:25:12 2015 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 64E62844 for ; Sun, 26 Apr 2015 03:25:12 +0000 (UTC) Received: from mpv1.tis.cwru.edu (mpv1.tis.cwru.edu [129.22.105.36]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "mpv1.tis.cwru.edu", Issuer "InCommon Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2E5E1CEB for ; Sun, 26 Apr 2015 03:25:11 +0000 (UTC) Received: from mpv6.tis.CWRU.Edu (EHLO mpv6.cwru.edu) ([129.22.104.221]) by mpv1.tis.cwru.edu (MOS 4.3.5-GA FastPath queued) with ESMTP id BVJ34279; Sat, 25 Apr 2015 23:18:47 -0400 (EDT) Received: from mail-qk0-f180.google.com (EHLO mail-qk0-f180.google.com) ([209.85.220.180]) by mpv6.cwru.edu (MOS 4.3.5-GA FastPath queued) with ESMTP id BAJ69214; Sat, 25 Apr 2015 23:18:46 -0400 (EDT) Received: by qkgx75 with SMTP id x75so48733219qkg.1 for ; Sat, 25 Apr 2015 20:18:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=jbpnwp39BsmXsqIEHoJIHl7oxsog+wKsJH808EuMo2Y=; b=LfqSRUyT7HwujYGg6XpGG4z+6AJxQdkRoAKXWJfoX7HzasNCsZcvxX2iNtW2jvL37J ja9tlELO4+EUNhM+kOlmVZOnnwZIgKKkmDoj0FFaK81IQ7COSBiT2/QYNUcqPhIoVraG N8ewbWSkuXhhQG2YxESDuB4Jjb44xLMFA6KHXjuzGnwAYk2cG27G4/K1zAMKezMseBSF 1ojy2gHh8GfWqUJsjEE1nsblMLdm+yyGMsPxP2Oq7aX8JfVjTnDq5KhSGxw4wpxpWplF i40zKS6y2reS19dAGxUuVkyg4KZG4Qqg061gp6eoD/bE24spT+TnRENHTu34CGP5mK5h BmXA== X-Gm-Message-State: ALoCoQnrCx5LvGg2Qm8H2NVtAidNivCTydhjXMLWSSF+RSMz/+2SMUt/3WWS1rwdQtXE9SdvPL7IWoLdLj3ED6wAWCevMpr/CmxvFjXhFxt7UT2o5oyAMNrkaWKMVl2BJ1NubDDtX7uQ39UdOTgRuhikuosTmA8HvA== X-Received: by 10.55.17.21 with SMTP id b21mr6081195qkh.71.1430018325976; Sat, 25 Apr 2015 20:18:45 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.55.17.21 with SMTP id b21mr6081191qkh.71.1430018325919; Sat, 25 Apr 2015 20:18:45 -0700 (PDT) Received: by 10.96.181.164 with HTTP; Sat, 25 Apr 2015 20:18:45 -0700 (PDT) Received: by 10.96.181.164 with HTTP; Sat, 25 Apr 2015 20:18:45 -0700 (PDT) In-Reply-To: <20150420081756.GC2390@kib.kiev.ua> References: <20150420081756.GC2390@kib.kiev.ua> Date: Sat, 25 Apr 2015 20:18:45 -0700 Message-ID: Subject: Re: Clearing sbss/bss at bootup From: Justin Hibbits To: Konstantin Belousov Cc: FreeBSD PowerPC ML , Justin Hibbits X-Junkmail-Status: score=10/53, host=mpv1.tis.cwru.edu X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A020201.553C5917.007E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=209.85.220.180, so=2012-07-18 11:21:25, dmn=2013-03-21 17:37:32, mode=single engine X-Junkmail-IWF: false Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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: Sun, 26 Apr 2015 03:25:12 -0000 On Apr 20, 2015 4:38 AM, "Konstantin Belousov" 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