Date: Sat, 09 Nov 2002 01:32:30 +0900 (JST) From: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org> To: gjohnson@srrc.ars.usda.gov Cc: stable@FreeBSD.ORG Subject: Re: machdep.c problem [was Re: SMP broken on PPro] Message-ID: <20021109.013230.98854530.iwasaki@jp.FreeBSD.org> In-Reply-To: <20021105202341.GA86211@node1.cluster.srrc.usda.gov> References: <20021105105146.GB57295@HAL9000.homeunix.com> <20021105201738.GA86056@node1.cluster.srrc.usda.gov> <20021105202341.GA86211@node1.cluster.srrc.usda.gov>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, > > The problem on -STABLE is with /sys/i386/i386/machdep.c, revision > > 1.385.2.26. I am not smart enough to know exactly what is wrong > > with the diff but reverting back to revision 1.385.2.25 of > > /sys/i386/i386/machdep.c fixes the problem. > > > > Apparently, the problem is BIOS specific so that explains why I only > > saw it on one of my machines (the oldest) and not the others. This > > would also explain why other people have not seen the problem. At > > this point I would say that the problem really has nothing to do with > > SMP, it just so happened that I experienced the problem on an SMP > > machine. > > Should I file a PR on this, even though I do not know what the fix is? Now I got spare time for making patches for this :-) Please test the patch, and let me know if any problems or side effects were found. Also suggestions for better solution would be welcome. I'll commit equivalent fix to CURRENT within couple of days, then MFC another couple of days later. 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 15:30:06 -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,24 @@ 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. + */ + for (pa = (4 << 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 = 4; 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. */ @@ -1537,6 +1556,19 @@ 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. + */ + pte = (pt_entry_t)vm86paddr; + for (i = 4; i < 160; i++) + pte[i] = saved_pte[i]; + for (pa = (4 << PAGE_SHIFT); pa < ISA_HOLE_START; pa += PAGE_SIZE) { + pte = (pt_entry_t)vtopte(pa + KERNBASE); + *pte = 0; + } /* * Perform "base memory" related probes & setup To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021109.013230.98854530.iwasaki>