From owner-freebsd-hackers@FreeBSD.ORG Sat May 12 23:36:10 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 359BF106566C for ; Sat, 12 May 2012 23:36:10 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id F345A8FC14 for ; Sat, 12 May 2012 23:36:09 +0000 (UTC) Received: by dadv36 with SMTP id v36so5115933dad.13 for ; Sat, 12 May 2012 16:36:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=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=3BG1cp2NgfU7Z3mjVr4LsHHt72h2Oz7E2VNmQfvNRqM=; b=YPItJ4ObMWl8kX0JetzxtVLDgM1PZdXiTg2zD8fVTKIPMGN9hrtRIDdotzmAoricIg QS9hx3hzJogkITdI+sAeETiBj4Ga7pWZkmkN/jgARPlmphVxPD/isua8a4HkKMDMtsIH BRPokLoSSROpVDBFXkXZHMCzyt6TXoRnH2TWIMKLHlLVomBOO9BjBQl7shNoXFADYHB/ lkQ1uEmmO32tp/TO8qdHzkXcyYvU240DepVQDhlgAxjK7TVLOatS5tIgEyT+SXucrcwn TtfU8OuJlZjnOO1O87PFbMLE0p6MNjGMmpBSl22XCRlqdxFwo7keS3IlN7tXH6/AvVG/ PdxQ== Received: by 10.68.231.164 with SMTP id th4mr8550692pbc.97.1336865769634; Sat, 12 May 2012 16:36:09 -0700 (PDT) Received: from [192.168.1.69] (99-74-169-43.lightspeed.sntcca.sbcglobal.net. [99.74.169.43]) by mx.google.com with ESMTPS id nv2sm17283070pbb.6.2012.05.12.16.36.06 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 May 2012 16:36:08 -0700 (PDT) Sender: Tim Kientzle Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Tim Kientzle In-Reply-To: Date: Sat, 12 May 2012 16:36:04 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <3B2A320B-3ADE-4F48-B94E-4F0886178251@freebsd.org> <201205070957.03842.jhb@freebsd.org> <8B01DF29-747A-449C-A762-E852F57C6380@freebsd.org> To: Marcel Moolenaar X-Mailer: Apple Mail (2.1257) X-Gm-Message-State: ALoCoQmOqKFglpfXLDPYROIggMNdnT6tigp5NGofWQr8J7hQAr/xzxAU+rmgQw8hTMdETgB6UWiw Cc: arm@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: How does loader(8) decide where to load the kernel? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 23:36:10 -0000 On May 10, 2012, at 5:32 AM, Marcel Moolenaar wrote: >=20 > On May 8, 2012, at 1:32 AM, Tim Kientzle wrote: >>>> On i386, amd64, powerpc, and arm, loadimage subtracts >>>> the dest value from the address declared in the actual ELF >>>> headers so that the kernel always gets loaded into low memory. >>>> (there's some intermediate bit-twiddling I'm glossing over, but >>>> this is the general idea). >>>=20 >>> The bit twiddling is supposed to be the equivalent of subtracting >>> KERNBASE from the load address. On both i386 and amd64, there is >>> a direct mapping of the kernel text such that KERNBASE maps address >>> 0, etc. By default on i386 KERNBASE is 0xc0000000. >>=20 >> Exactly my problem. This all assumes that you're loading >> the kernel into low memory. >>=20 >> On the AM3358, the DRAM starts at 0x8000 0000 >> on boot, so I'm trying to find a clean way to convince >> the loader's ELF code to put the kernel there. >=20 > Look at what I did for ia64. All that frobbing should be done > in the machine specific implementation of arch_copyin, arch_copyout > and arch_readin. It's a kluge to do it in elf_loadimage. That sounds like a reasonable approach. I've started working down that path=85 but it looks like I'll have to fix a lot of the FDT code along the way. Tim