Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Oct 2003 15:19:51 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Peter Wemm <peter@wemm.org>
Cc:        cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/i386/i386 locore.s 
Message-ID:  <20031005145547.X3175@gamplex.bde.org>
In-Reply-To: <20031004065103.EBE312A7EA@canning.wemm.org>
References:  <20031004065103.EBE312A7EA@canning.wemm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 3 Oct 2003, Peter Wemm wrote:

> Peter Wemm wrote:
>
> >   This is bad though because it gives kernel mode code the opportunity
> >   to accidently write to the first few megs of the general page pool
> >   which is remapped at KERNBASE.  It needs to be fixed properly.
>
> I'm not sure, now that I think about it more, I think Bruce may have tried
> to tell me about this once or twice before.  Possibly when I was tinkering
> with pmap_mapdev last time.

I only remember complaining about the read-onlyness of the text section
being broken by 4MB pages.  This still seems to be broken.  It now seems
to be broken even in the !PSE case -- we now map r/w from btext to KERNend
where we used to map r/o from btext to etext and r/w from etext to KERNend.

My kernel was affected by the write-only page 0 in a different way.  I
had quick-fixed the setting clean-reboot signature (0x1234 at 0x472
physical) by setting it in cpu_reset_real():

%%%
diff -c2 src/sys/i386/i386/vm_machdep.c~ src/sys/i386/i386/vm_machdep.c
*** src/sys/i386/i386/vm_machdep.c~	Sat Aug 30 19:35:06 2003
--- src/sys/i386/i386/vm_machdep.c	Sat Aug 30 20:36:33 2003
***************
*** 531,534 ****
--- 509,522 ----
  {

+ #ifndef PC98
+ 	/*
+ 	 * Tell the BIOS to warm boot.  XXX magic.
+ 	 * XXX this depends on brokenness of readonlyness of the text
+ 	 * section caused by 4MB pages.
+ 	 */
+ 	if (cpu_feature & CPUID_PSE && rcr4() & CR4_PSE && panicstr == NULL)
+ 		*(short *)(KERNBASE + 0x472) = 0x1234;
+ #endif
+
  #ifdef PC98
  	/*
%%%

The point of this signature has been defeated since 386BSD-0.0 by setting
it in locore.s.  The above failed for obvious reasons when 4MB pages stopped
affecting page 0.

Bruce



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