cvs commit: src/sys/i386/i386 locore.s

Bruce Evans bde at zeta.org.au
Sat Oct 4 22:21:30 PDT 2003


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


More information about the cvs-src mailing list