From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 15 19:27:39 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51CAC16A4CE for ; Wed, 15 Dec 2004 19:27:39 +0000 (GMT) Received: from f21.mail.ru (f21.mail.ru [194.67.57.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9DE143D45 for ; Wed, 15 Dec 2004 19:27:38 +0000 (GMT) (envelope-from shmukler@mail.ru) Received: from mail by f21.mail.ru with local id 1Ceeo9-000EFu-00; Wed, 15 Dec 2004 22:27:33 +0300 Received: from [68.79.248.66] by koi.mail.ru with HTTP; Wed, 15 Dec 2004 22:27:33 +0300 From: Igor Shmukler To: Vijay.Singh@nokia.com Mime-Version: 1.0 X-Mailer: mPOP Web-Mail 2.19 X-Originating-IP: [68.79.248.66] Date: Wed, 15 Dec 2004 22:27:33 +0300 In-Reply-To: Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit Message-Id: cc: hackers@freebsd.org Subject: Re: loading kernel at any physical address X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Igor Shmukler List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Dec 2004 19:27:39 -0000 I think this might be somewhat off topic, but to support superpages you probably want kernel to be aligned on 4MB boundary. Also, Mach had macros for alignment. I browsed code and it seems there are macros in i386/include/asmacros.h Perhaps I am missing something, but I don't see why would you want to align with NOPS. -----Original Message----- From: To: Date: Wed, 15 Dec 2004 10:43:45 -0800 Subject: loading kernel at any physical address > Hello all, for a project I am trying to figure out how to boot a FreeBSD kernel loaded at any physical address. Right now the locore.s magic works because the load addres (KERNLOAD) and (KERNBASE) are set such that > > #define R(foo) ((foo)-KERNBASE) > > macro is able to get the addresses before paging is enabled. > > If the loadaddress information is not embedded in defines, then is the following solution expected to work: > > .globl _loadaddress /* should be at 16M aligned ??? */ > .set _loadaddress,KERNBASE > > and then: > > NON_GPROF_ENTRY(btext) > > nop /* nops for 8 byte alignment */ > nop > nop > call 0f > 0: > mov 4(%ebp), %eax > add $-8, %eax /* This is actual physical load addr */ > add $-0x100000, %eax > subl %eax, _loadaddress /* new kernbase w.r.t load addr */ > /* instead of standard 1MB reloc */ > > and then > > #define R(foo) ((foo)- _loadaddress) > > One issue might be loadaddress over 16M, but for this problem we can assume that the processor has been in protected mode, so it has access to that space. > > Any input on this is highly appreciated. > > br > vijay