From owner-freebsd-hackers@FreeBSD.ORG Thu May 10 12:32:37 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D332106566C; Thu, 10 May 2012 12:32:37 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id E9A208FC0A; Thu, 10 May 2012 12:32:36 +0000 (UTC) Received: from sa-nc-cs-39.static.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id q4ACWSvP075253 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 10 May 2012 05:32:35 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: Marcel Moolenaar In-Reply-To: <8B01DF29-747A-449C-A762-E852F57C6380@freebsd.org> Date: Thu, 10 May 2012 08:32:23 -0400 Content-Transfer-Encoding: 7bit Message-Id: References: <3B2A320B-3ADE-4F48-B94E-4F0886178251@freebsd.org> <201205070957.03842.jhb@freebsd.org> <8B01DF29-747A-449C-A762-E852F57C6380@freebsd.org> To: Tim Kientzle X-Mailer: Apple Mail (2.1278) 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: Thu, 10 May 2012 12:32:37 -0000 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). >> >> 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. > > Exactly my problem. This all assumes that you're loading > the kernel into low memory. > > 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. 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. FYI, -- Marcel Moolenaar marcel@xcllnt.net