From owner-freebsd-stable@FreeBSD.ORG Thu Oct 26 15:04:41 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0453816A403; Thu, 26 Oct 2006 15:04:41 +0000 (UTC) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85C9A43D76; Thu, 26 Oct 2006 15:04:34 +0000 (GMT) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id 755CE5D5E; Thu, 26 Oct 2006 18:42:40 +0400 (MSD) Received: from edoofus.park.rambler.ru (unknown [81.19.65.108]) by relay0.rambler.ru (Postfix) with ESMTP id 5296D5D5C; Thu, 26 Oct 2006 18:42:40 +0400 (MSD) Received: (from ru@localhost) by edoofus.park.rambler.ru (8.13.8/8.13.8) id k9QEgevd001336; Thu, 26 Oct 2006 18:42:40 +0400 (MSD) (envelope-from ru) Date: Thu, 26 Oct 2006 18:42:40 +0400 From: Ruslan Ermilov To: John Baldwin Message-ID: <20061026144240.GB1219@rambler-co.ru> References: <3A8131D4-881E-4873-A682-543A1A88C063@lassitu.de> <20061026222234.P2553@epsplex.bde.org> <20061026141830.GA790@rambler-co.ru> <200610261028.10680.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aVD9QWMuhilNxW9f" Content-Disposition: inline In-Reply-To: <200610261028.10680.jhb@freebsd.org> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: No virus found Cc: freebsd-stable@freebsd.org, Stefan Bethke , Bruce Evans , Bruce Evans Subject: Re: Still possible to directly boot without loader? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2006 15:04:41 -0000 --aVD9QWMuhilNxW9f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 26, 2006 at 10:28:09AM -0400, John Baldwin wrote: > On Thursday 26 October 2006 10:18, Ruslan Ermilov wrote: > > On Thu, Oct 26, 2006 at 10:52:30PM +1000, Bruce Evans wrote: > > > On Thu, 26 Oct 2006, Ruslan Ermilov wrote: > > > >3) It's currently broken even on i386; backing out > > > > rev. 1.71 of boot2.c by jhb@ fixes this for me. > > > > > > > >: revision 1.71 > > > >: date: 2004/09/18 02:07:00; author: jhb; state: Exp; lines: +3 -3 > > > >: A long, long time ago in a CVS branch far away (specifically, HEAD= prior > > > >: to 4.0 and RELENG_3), the BTX mini-kernel used paging rather than = flat > > > >: mode and clients were limited to a virtual address space of 16 meg= abytes. > > > >: Because of this limitation, boot2 silently masked all physical add= resses > > > >: in any binaries it loaded so that they were always loaded into the= first > > > >: 16 Meg. Since BTX no longer has this limitation (and hasn't for a= long > > > >: time), remove the masking from boot2. This allows boot2 to load k= ernels > > > >: larger than about 12 to 14 meg (12 for non-PAE, 14 for PAE). > > > >: > > > >: Submitted by: Sergey Lyubka devnull at uptsoft dot com > > > >: MFC after: 1 month > > >=20 > > > The kernel is linked at 0xc0000000 but loade din low memory, so the h= igh > > > bits must be masked off like they used to be for the kernel to boot a= t all. > > > This has nothing to do with paging AFAIK. Rev.1.71 makes no sense, s= ince > > > BTX isn't large, and large kernels are more unbootable than before wi= th > > > 1.71. > > >=20 > > The real purpose of this commit was to allow to directly "load kernels > > larger than about 12 to 14 meg (12 for non-PAE, 14 for PAE)". (Old > > version masked high 8 bits, leaving only 2^24=3D16MB for the kernel.) > >=20 > > I have compiled GENERIC and PAE kernels; objdump(1) reports that GENERIC > > kernel has virtual "start address 0xc0449cb0", and PAE has virtual "sta= rt > > address 0xc02458f0". >=20 > Yes, KERNLOAD for PAE is 2MB and for non-PAE is 4MB (to skip PSE page 0). >=20 > > What happens here is that BTX now uses flat memory model, and by not > > masking higher bits at all, BTX attempts to load kernels at above 3G, > > which silently fails, and then jumps to the entry point located in > > "no memory" unless the machine has enough memory. > >=20 > > If the machine has enough physical memory, e.g. 4G, then it works (I > > think that was the case on the machine John tested this change), but > > on my test machine I only have 3G of memory, so it fails. >=20 > Actually, it should never work, as the kernel assumes it is loaded at > KERNLOAD. >=20 > > My interim solution to the problem that would still allow booting > > larger than 16MB kernels is to mask some of the higher bits. > > Currently, I mask 28 bits that gives possible 256MB which is probably > > practical. >=20 > boot2 should do whatever loader does. >=20 But this would be a regression, since loader(8) does the following, in the ELF32 case: : 0 edoofus:ttyp2:/sys/boot/i386/libi386 >grep -w entry elf32_freebsd.c : vm_offset_t entry, bootinfop, modulep, kernend; : entry =3D ehdr->e_entry & 0xffffff; : printf("Start @ 0x%lx ...\n", entry); : __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep= , kernend); Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --aVD9QWMuhilNxW9f Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFQMlgqRfpzJluFF4RAsW2AJ43sLbM9WuLF4AICt1KWsYNuJ72pgCdG0Xb y7pq4UQtXdYbCXsHxWkzzfo= =aHMU -----END PGP SIGNATURE----- --aVD9QWMuhilNxW9f--