From owner-freebsd-stable Fri Nov 8 11:18:35 2002 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 6096F37B401 for ; Fri, 8 Nov 2002 11:18:32 -0800 (PST) Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0185D43E6E for ; Fri, 8 Nov 2002 11:18:31 -0800 (PST) (envelope-from iwasaki@jp.FreeBSD.org) Received: from localhost (iwa@tasogare.imasy.or.jp [202.227.24.5]) by tasogare.imasy.or.jp (8.11.6+3.4W/8.11.6/tasogare) with ESMTP/inet id gA8JI8i92698; Sat, 9 Nov 2002 04:18:09 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) Date: Sat, 09 Nov 2002 04:18:02 +0900 (JST) Message-Id: <20021109.041802.45867347.iwasaki@jp.FreeBSD.org> To: arg-bsd@arg1.demon.co.uk Cc: stable@FreeBSD.org Subject: Re: machdep.c problem From: Mitsuru IWASAKI In-Reply-To: <20021108180141.B21142-100000@server.arg.sj.co.uk> References: <20021109.013230.98854530.iwasaki@jp.FreeBSD.org> <20021108180141.B21142-100000@server.arg.sj.co.uk> X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, > The patch does not work for me (Intel SCB2 motherboard, SMP, 2xP3Xeon). Thanks for reporting. > It stops in much the same place as before, but apparently gives > "Privileged instruction fault" this time (I do not have console access to > this machine, so I have to ask someone to look at the screen when it fails > to boot). OK, revised patches (w/ debug printing) attached. Could you let me know what was the last message one of these? 1. getmemsize: mapping BIOS work pages 2. getmemsize: calling INT 15:E820 3. getmemsize: unmapping BIOS work pages Also previous patches might give too many pages to BIOS. Can you adjust this value and try again increasing up to 159? #define BIOSWORKSTARTPAGE 152 > Perhaps you should back out the 1.135.2.26 commit to -stable until the > problem is fixed. Newer BIOS have another problem before 1.135.2.26 as you know. Modern OSes (such as MS WindowsXX and Linux) never use INT 12H to determine base memory size. If somebody can fix both problems, I would glad to commit the patches :-) Thanks Index: machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.385.2.26 diff -u -r1.385.2.26 machdep.c --- machdep.c 2 Nov 2002 05:07:18 -0000 1.385.2.26 +++ machdep.c 8 Nov 2002 18:39:19 -0000 @@ -1456,6 +1456,7 @@ struct vm86context vmc; vm_offset_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t pte; + unsigned int saved_pte[160]; const char *cp; struct { u_int64_t base; @@ -1468,6 +1469,27 @@ basemem = 0; /* + * Older BIOSes might intend to write to memory below 640kb. + * It is very small region actually, but we cannot determine + * the accurate base memory size here. + * Give enough pages to BIOS temporary during calling + * INT 15:E820 so that BIOS can access them. + */ +#define BIOSWORKSTARTPAGE 152 +printf("%s: mapping BIOS work pages\n", __func__); + for (pa = (BIOSWORKSTARTPAGE << PAGE_SHIFT); + pa < ISA_HOLE_START; pa += PAGE_SIZE) { + pte = (pt_entry_t)vtopte(pa + KERNBASE); + *pte = pa | PG_RW | PG_V; + } + + pte = (pt_entry_t)vm86paddr; + for (i = BIOSWORKSTARTPAGE; i < 160; i++) { + saved_pte[i] = pte[i]; + pte[i] |= PG_V | PG_RW | PG_U; + } + + /* * map page 1 R/W into the kernel page table so we can use it * as a buffer. The kernel will unmap this page later. */ @@ -1479,6 +1501,7 @@ */ #define SMAPSIZ sizeof(*smap) #define SMAP_SIG 0x534D4150 /* 'SMAP' */ +printf("%s: calling INT 15:E820\n", __func__); vmc.npages = 0; smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT)); @@ -1537,6 +1560,22 @@ physmap[physmap_idx + 1] = smap->base + smap->length; next_run: } while (vmf.vmf_ebx != 0); + + /* + * Unmap the pages which were given for BIOS. + * Some pages below 640kb will be mapped again if necessary + * after base memory size is determined. + */ +printf("%s: unmapping BIOS work pages\n", __func__); + pte = (pt_entry_t)vm86paddr; + for (i = BIOSWORKSTARTPAGE; i < 160; i++) + pte[i] = saved_pte[i]; + for (pa = (BIOSWORKSTARTPAGE << PAGE_SHIFT); + pa < ISA_HOLE_START; pa += PAGE_SIZE) { + pte = (pt_entry_t)vtopte(pa + KERNBASE); + *pte = 0; + } +#undef BIOSWORKSTARTPAGE /* * Perform "base memory" related probes & setup To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message