From owner-freebsd-arm@FreeBSD.ORG Thu Feb 28 06:41:22 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A526767F for ; Thu, 28 Feb 2013 06:41:22 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id 57EC1E15 for ; Thu, 28 Feb 2013 06:41:22 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id 16so1640802iea.8 for ; Wed, 27 Feb 2013 22:41:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer:x-gm-message-state; bh=9pN/l4jgPCUT8qP4Ti7/n1qeSG8tWSaax2Ba3SQdbt8=; b=Uk+JUiht0u/+E99ha8GAEeZ20RdmOs73ig5odJxgcDJ0k2MLJ8sqeUvH9NifAP0tBo IgdfTlgPA36whnYxXy2OR9lz/Ccu2wQxZjaVk/01jOSWC1GTcfU7EjwdqWPBVSfDq5Kp QmUDV/EvsVQ2Hw5HGqpKQfG+ol+Nar8nFDcx1yIUVy7G2JNZQong3iCMeOPJ+ECmaaVQ ehYDAlbdidRGSgTLJvfxT/j0S7f5RhnhMJtjmIa+e3StKxzULEehASFYVNmfsu0Y4sqo CR0UqeUoV6qDTfcYAJAXeDo547G1TY9r/47QGnRnrIcfv4bB2xpNzPeZr8RorIlDOMCV x0Wg== X-Received: by 10.50.46.197 with SMTP id x5mr9019699igm.7.1362033681715; Wed, 27 Feb 2013 22:41:21 -0800 (PST) Received: from 53.imp.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPS id z1sm10345804igc.1.2013.02.27.22.41.19 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Feb 2013 22:41:20 -0800 (PST) Sender: Warner Losh Subject: Re: PHYSADDR Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=windows-1252 From: Warner Losh In-Reply-To: Date: Wed, 27 Feb 2013 23:41:18 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <1A428660-39FB-45EB-979B-103F7E83BC4A@bsdimp.com> References: To: Tim Kientzle X-Mailer: Apple Mail (2.1085) X-Gm-Message-State: ALoCoQmiRR02FstLAMkvwclnqJV5zirSRKjXJziZzwfOzSRjRvAAm1N/y/MWFqwA12o8vG5O6fav 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: Thu, 28 Feb 2013 06:41:22 -0000 On Feb 27, 2013, at 11:27 PM, Tim Kientzle wrote: > Starting to look at what is needed for a Generic ARM kernel. > There's a lot here; I sincerely hope I'm not the only one=85 ;-) >=20 > First up: Can we get rid of PHYSADDR? There's lots of places in the tree that use it, but not so many that a = whack-a-mole approach wouldn't work. > I think we can always compute it at runtime from PC. >=20 > For example, I think this works in several places: > and r0, pc, #0xF0000000 This only works early in boot before we've turned on the MMU, right? > And I've found at least one reference that I think can be simply > eliminated: >=20 > Index: arm/elf_trampoline.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- arm/elf_trampoline.c (revision 247250) > +++ arm/elf_trampoline.c (working copy) > @@ -169,7 +169,7 @@ > void > _startC(void) > { > - int physaddr =3D KERNPHYSADDR; > + unsigned int physaddr =3D (unsigned int)&_start & 0xfffff000; How'd you come up with this? Perhaps we should just define KERNPHYSADDR = as this gross expression :) But isn't _start a virtual address, not a physical address? > int tmp1; > unsigned int sp =3D ((unsigned int)&_end & ~3) + 4; > #if defined(FLASHADDR) && defined(LOADERRAMADDR) > @@ -189,10 +189,9 @@ > */ > unsigned int target_addr; > unsigned int tmp_sp; > - uint32_t src_addr =3D (uint32_t)&_start - PHYSADDR + = FLASHADDR > - + (pc - FLASHADDR - ((uint32_t)&_startC - PHYSADDR)) = & 0xfffff000; > + uint32_t src_addr =3D (uint32_t)&_start; I'm not sure how this works... > - target_addr =3D (unsigned int)&_start - PHYSADDR + = LOADERRAMADDR; > + target_addr =3D (unsigned int)&_start - (pc & = 0xf0000000) + LOADERRAMADDR; This might work, but I'd suggest a PC_TO_PHYSADDR(pc) macro or something = similar... > tmp_sp =3D target_addr + 0x100000 + > (unsigned int)&_end - (unsigned int)&_start; > memcpy((char *)target_addr, (char *)src_addr, >=20 >=20 > Tim >=20