From owner-freebsd-arm@FreeBSD.ORG Sun May 5 22:37:34 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C8E63C00 for ; Sun, 5 May 2013 22:37:34 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from nibbler.fubar.geek.nz (nibbler.fubar.geek.nz [199.48.134.198]) by mx1.freebsd.org (Postfix) with ESMTP id ADFF6FD5 for ; Sun, 5 May 2013 22:37:34 +0000 (UTC) Received: from bender.lan (46-37-55-91.dsl.cnl.uk.net [46.37.55.91]) by nibbler.fubar.geek.nz (Postfix) with ESMTPSA id 053E85E1F5; Sun, 5 May 2013 22:37:32 +0000 (UTC) Date: Sun, 5 May 2013 23:37:29 +0100 From: Andrew Turner To: Tim Kientzle Subject: Re: Is this related to the general panic discussed in freebsd-current? Message-ID: <20130505233729.63ac23bc@bender.lan> In-Reply-To: References: <51835891.4050409@thieprojects.ch> <03971BD1-4ADE-4435-BDD0-B94B62634F1D@bsdimp.com> <5183BF8C.4040406@thieprojects.ch> <6D0E82C9-79D1-4804-9B39-3440F99AA8FE@kientzle.com> <20130505140006.0d671ba5@bender> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 May 2013 22:37:34 -0000 On Sun, 5 May 2013 09:37:48 -0700 Tim Kientzle wrote: > On May 5, 2013, at 6:00 AM, Andrew Turner wrote: > > > On Sat, 4 May 2013 15:44:37 -0700 > > Tim Kientzle wrote: > >> I'm baffled. If I insert a printf into the loop in stack_capture, > >> the kernel boots. But the generated assembly looks perfectly > >> correct to me in either case. So inserting the printf must have > >> some side-effect. > >> > >> The stack does end up aligned differently: The failing version > >> puts 16 bytes on the stack, the working version puts 24 bytes. > >> But I can't figure out how that would explain what I'm seeing... > > > > It feels like an alignment issue but those stack sizes should both > > be valid. Are you able to send me the asm for the working and broken > > versions of the function? > > > > Also which ABI are you using? I have not been able to reproduce it > > with EABI, but that may have been because I have a patched clang > > I've been using to track down another issue. > > I'm using whatever the default is in FreeBSD-CURRENT. I've seen > this consistently with both RaspberryPi and BeagleBone kernels > for the last few weeks. Ok, it's the old ABI. I note this function may be broken with EABI as it make assumptions on the layout of each frame. > If you see anything actually wrong with the "Broken version", > I'm very curious. I spent much of yesterday afternoon staring > at it and cannot for the life of me see a problem with it. I can't see anything different with the asm that can't be explained by the added printf call. > /* Broken version */ > c0519cec : > void > stack_save(struct stack *st) > { > c0519cec: e92d4830 push {r4, r5, fp, lr} This stack layout is incorrect. It should store (from a low address to high address) r4, r5, fp, ip, lr and pc. The unwind code following is incorrect for this stack layout. In your working code how deep is the stack you are printing? I suspect you are getting lucky with the data on the stack. Andrew