From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UcEsN-0004WL-70 for mharc-grub-devel@gnu.org; Tue, 14 May 2013 09:02:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcEsH-0004Vs-9S for grub-devel@gnu.org; Tue, 14 May 2013 09:02:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcEsF-00018V-UQ for grub-devel@gnu.org; Tue, 14 May 2013 09:02:37 -0400 Received: from mout.web.de ([212.227.17.11]:64502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcEsF-00017s-LE for grub-devel@gnu.org; Tue, 14 May 2013 09:02:35 -0400 Received: from frosties.localnet ([95.208.119.3]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MduO5-1Ut4Eu48M9-00QMeR for ; Tue, 14 May 2013 15:02:34 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.80) (envelope-from ) id 1UcEsB-00082G-MM for grub-devel@gnu.org; Tue, 14 May 2013 15:02:31 +0200 Date: Tue, 14 May 2013 15:02:31 +0200 From: Goswin von Brederlow To: grub-devel@gnu.org Subject: Re: [PATCH] ARM U-Boot BSS zeroing Message-ID: <20130514130231.GC27079@frosties> References: <20130513153729.GL28516@rocoto.smurfnet.nu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130513153729.GL28516@rocoto.smurfnet.nu> User-Agent: Mutt/1.5.21 (2010-09-15) X-Provags-ID: V02:K0:FqH21cxk8tUtqh3kgRUMfa02qv7AH6NpVIxC1T9Tyha E4hq/zCL4EQ2OdbP7lyT8cIyUDnyL6EJ+7FOXPlhWiMDzUa5hb y2HvaNLMLg79uVFHCYelUWHBtsdZTZPsUrwW4/k84Vg8mpXxnD Zx/YS/XCx94kHR00q6ht+O0OGQcUBVnTFWgq047doLgjocnSYZ uaHBxfL/JEYRVnA2/nNnA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.11 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2013 13:02:42 -0000 On Mon, May 13, 2013 at 03:37:32PM +0000, Leif Lindholm wrote: > The import into the collaborative branch discarded the call to > get_real_bss_start before starting the BSS zeroing operation. > > While get_real_bss_start might have been a bit of an ugly hack, > simply discarding it means that we now end up doing unaligned > STR operations, and any platform with MMU disabled fails to boot. > > The attached patch prepends a bytewise zeroing loop until > word-aligned, and then continue as before. > > / > Leif > === modified file 'grub-core/kern/arm/uboot/startup.S' > --- grub-core/kern/arm/uboot/startup.S 2013-05-03 13:07:39 +0000 > +++ grub-core/kern/arm/uboot/startup.S 2013-05-13 14:59:43 +0000 > @@ -100,7 +100,13 @@ > @ Since we _are_ the C run-time, we need to manually zero the BSS > @ region before continuing > ldr r0, =EXT_C(__bss_start) @ zero from here > - ldr r1, =EXT_C(_end) @ to here > + @ If unaligned, bytewise zero until base address aligned. > + mov r1, #0 > +1: tst r0, #3 > + beq 2f > + strb r1, [r0], #1 > + b 1b > +2: ldr r1, =EXT_C(_end) @ to here > mov r2, #0 > 1: str r2, [r0], #4 > cmp r0, r1 What if I have a 1 byte BSS aligned at 1 byte? You would zero 3 bytes and overshoot _end and then what happens after the cmp in the last line? MfG Goswin