Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2002 10:51:17 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
Cc:        current@FreeBSD.ORG
Subject:   Re: [PATCH] Workaround for bogus INT 12H BIOS service implementation
Message-ID:  <20021022103609.V12732-100000@gamplex.bde.org>
In-Reply-To: <20021022.003512.15273101.iwasaki@jp.FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021022103609.V12732-100000>