From owner-freebsd-current Mon Oct 21 17:40:36 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A817E37B401 for ; Mon, 21 Oct 2002 17:40:34 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A7A243E42 for ; Mon, 21 Oct 2002 17:40:33 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id KAA17773; Tue, 22 Oct 2002 10:40:22 +1000 Date: Tue, 22 Oct 2002 10:51:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Mitsuru IWASAKI Cc: current@FreeBSD.ORG Subject: Re: [PATCH] Workaround for bogus INT 12H BIOS service implementation In-Reply-To: <20021022.003512.15273101.iwasaki@jp.FreeBSD.org> Message-ID: <20021022103609.V12732-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 22 Oct 2002, Mitsuru IWASAKI wrote: > > > > Hmmm, actually no. I know that some machines get panic with fatal trap > > > > 12 if we do 0x12 call. The worst case is getting panic, not losing > > > > 640K memory. > > > ... > > ... > FYI: On RELENG_4, this problem is critical too because this panic > isn't recoverable. This means that it's impossible to install onto > some newer machines. > ... > I've recalled that FreeBSD used RTC to determine base memory size in > old days. I've tested this method on my machines and confirmed it's > working well. > > I'll commit this coming weekend if no objections. > Index: machdep.c > =================================================================== > RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v > retrieving revision 1.541 > diff -u -r1.541 machdep.c > --- machdep.c 5 Oct 2002 14:36:14 -0000 1.541 > +++ machdep.c 21 Oct 2002 15:27:02 -0000 > @@ -1284,8 +1284,14 @@ > /* > * Perform "base memory" related probes & setup > */ > - vm86_intcall(0x12, &vmf); > - basemem = vmf.vmf_ax; > + if ((basemem = rtcin(RTC_BASELO) + (rtcin(RTC_BASEHI)<<8)) > 640) > + basemem = 640; > + > + if (basemem == 0) { > + vm86_intcall(0x12, &vmf); > + basemem = vmf.vmf_ax; > + } > + > if (basemem > 640) { > printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", > basemem); > This would reintroduce a large bug. The RTC gives the hardware memory size, but the interrupt gives the software memory size. These differ for one of two machines under my desk (both have Award BIOSes). The BIOS often steals some of the base memory. It's hard to tell whether this memory will be used after FreeBSD determines the memory size. It might be used for VM86 or (much more magically) for SMM. Reading the memory size from BIOS RAM (offset 0x413) would be safer. I'm not sure how standard this is. I thought that it is less standard than INT 0x12. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message