From owner-freebsd-arm@FreeBSD.ORG Sun Feb 2 22:05:53 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F6E0F6C for ; Sun, 2 Feb 2014 22:05:53 +0000 (UTC) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 043B4143B for ; Sun, 2 Feb 2014 22:05:52 +0000 (UTC) Received: by mail-ob0-f173.google.com with SMTP id vb8so7204379obc.32 for ; Sun, 02 Feb 2014 14:05:46 -0800 (PST) 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=8YHzVAi+2NbqlgEF+8EnS6Yr+yhSxdZ+dVxyTA8LbCk=; b=L/5Qi/1Mh9q6rMtbCnfMoVpKiNz2IlPRxSVyCaR2AlWPLn1qoYaAp9ajMHaGs7+/l0 fzgTlbdtbkrPL8QTC50L5ebvnuh37pg9yGpb+as/n/QiBrJznXPOEcbR/6IWWOmJjy/t LBdUdshM/DGypDtoq8x7RadKf03GnPqSD1733B0iC1CHBtwSUAWRs1EBfnelbgJnL2vq cJmWz9lIp1s/Q4BJKYIyHJZuTvBe7ZFFax6l2liMYMQljBL7/gZgY+2WL9+KvDYX66V7 e0qrlK1a5jeEKMoL3D9Y4O49Kw4h6mY7/ncyTsXp+yUskyPSmUwx2pPb7W0p1H9Yajr4 LhQA== X-Gm-Message-State: ALoCoQnZCbIpIREoglTQQ/W/AbExa3e8ViiDeZ1xnwJrKRL+ZJSBfVUlsAodx+BqQMFCWRckzDi9 MIME-Version: 1.0 X-Received: by 10.60.150.134 with SMTP id ui6mr85280oeb.62.1391377300604; Sun, 02 Feb 2014 13:41:40 -0800 (PST) Received: by 10.182.104.169 with HTTP; Sun, 2 Feb 2014 13:41:40 -0800 (PST) In-Reply-To: <1391371204.13026.43.camel@revolution.hippie.lan> References: <1391371204.13026.43.camel@revolution.hippie.lan> Date: Sun, 2 Feb 2014 14:41:40 -0700 Message-ID: Subject: Re: wandboard / imx6 / exynos4 / cortex-a9 "wrong-endian bug" fixed From: Tom Everett To: Ian Lepore Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: freebsd-arm , Bernd Walter X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Feb 2014 22:05:53 -0000 This has been a problem on Wandboard for a long time. Congrats on the fix! On Sun, Feb 2, 2014 at 1:00 PM, Ian Lepore wrote: > As some of you know from previous email or irc conversations, I've been > chasing a strange bug for months that affects some cortex-a9 chips, > which I've been calling the "wrong-endian bug", where some registers get > restored with wrong-endian values on return from an interrupt, leading > to a panic or crash during boot. > > I finally tracked the cause down to our gnu assembler (gas), which > apparently thinks that when you say "msr spsr_all, r0" what you meant by > "_all" was "only restore 16 of the 32 bits". It's not a bug per se, > it's just how the gas authors think the assembler should behave. So, > when the chip powers on there may be some garbage bits in the spsr > register, and they would never get cleared out because only some of the > bits would get restored, and if the big-endian bit was among them Bad > Things Happened. I'm not sure why this only affected some cortex-a9 > chips such as imx6, but maybe some chips set those registers to zero and > some don't at power-on. > > I fixed the problem by updating our source code to use the newer arm > instruction syntax for msr and msr instructions, which ensures all 32 > bits get restored. That change happened in r261393, but because of > other changes and churn in the tree the first really stable revision > that includes the fix is r261410. So if you're working with wandboard > or another imx6-based system, please make sure to update to this rev. > > -- Ian > > > -- A better world shall emerge based on faith and understanding - Douglas MacArthur