From owner-freebsd-hackers Thu Nov 6 02:04:09 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id CAA04905 for hackers-outgoing; Thu, 6 Nov 1997 02:04:09 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from bugs.us.dell.com (bugs.us.dell.com [143.166.169.147]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id CAA04868 for ; Thu, 6 Nov 1997 02:03:59 -0800 (PST) (envelope-from tony@dell.com) Received: from ant.us.dell.com (ant.us.dell.com [143.166.12.34]) by bugs.us.dell.com (8.6.12/8.6.12) with SMTP id EAA05636; Thu, 6 Nov 1997 04:01:32 -0600 Message-Id: <3.0.3.32.19971106040103.006ede20@bugs.us.dell.com> X-Sender: tony@bugs.us.dell.com X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.3 (32) Date: Thu, 06 Nov 1997 04:01:03 -0600 To: Terry Lambert From: Tony Overfield Subject: Re: >64MB Cc: jamil@trojanhorse.ml.org, hackers@FreeBSD.ORG In-Reply-To: <199711051858.LAA14121@usr02.primenet.com> References: <3.0.3.32.19971105020626.006da974@bugs.us.dell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> The bootloader already makes the "64 MB limited" BIOS call and sends >> this value to the kernel, but for some strange reason, the kernel >> tosses that value away in favor of the sometimes bogus CMOS value. >> Using this BIOS call's result instead of tossing it would resolve >> my complaint about the CMOS groping. >At 06:58 PM 11/5/97 +0000, Terry Lambert wrote: >The problem with this approach is "keyhole memory allocations" for >soft IDE drive tables and APM BIOS data that can't be overwritten. >This is a common practice among some PC manufacturers (who will >remain nameless). > >At least the "base memory" in the CMOS must be examined to determine >memory which can not be given over to the kernel for it to scribble on. Well, I was obviously talking about extended memory, not base memory, but I'll bite on this sucker bait anyway... ;-) I claim your argument is wrong. The INT 12h BIOS call will (and must) always reflect any "keyhole allocations". The RTC value will *not* reflect them. The BIOS call provides precisely the correct value, unless you happen to think the kernel should steal the memory back from the BIOS, which is, of course, extremely risky. My brief inspection of this code reveals (please correct me if I'm wrong) that the RTC base memory value is never even used (if the bootloader is recent and working, at least) except to produce benign error messages. If the RTC value is necessary, I sure don't see how. >The kernel loads at 1M, regardless of whether there is memory there >or not. Yes, the bootloader knows how much memory is available, but it fails to make the comparison. >There is no graceful failure mode possible for a failure to >load yourself. How about this message, "Not enough extended memory found! (4 MB needed)"? No, I'm not really arguing for any changes here, the days of 640K systems are long gone, but graceful failure is indeed possible. >Given this, a kernel with VM86() capabilities loaded into however >much memory it takes, starting at 1M, can make VM86() calls to >determine how much memory is there. You yourself note that the CMOS >examination for memory sizing is bogusly used at present ...and that >it occurs *after* the kernel is loaded. Yes, but the bootloader already knows how much memory is there. It knows this before the kernel is loaded. It can make sure there is enough memory before the kernel is loaded. It can and does pass that value to the kernel after it is loaded. The kernel then throws it away and gets the wrong information from the CMOS. >> At *least* the "64 MB limited" BIOS call must be in the bootloader. > >At present, and only because the call historically can't be made by >the kernel in protected mode. That's close to being fixed. It only needs to be in the bootloader if you want to make sure there is enough memory to load the kernel, or if you want to remove the bogus CMOS stuff before the vm86() support is working. Right now, the value obtained from the boot loader is completely extraneous except for the useless error message. Speaking of vm86(), why not just use real-mode? It's easier and much better for compatibility while booting. I do remember your dreams of running SCSI option ROM code in multi-use mode, but that's surely a long way off. The APM init code seems to have a good example of making real-mode BIOS calls from the kernel during initialization. - Tony