Subject: Re: Questions on Kernel VM space
To: Bob Nestor <rnestor@metronet.com>
From: Paul Goyette <paul@whooppee.com>
List: port-mac68k
Date: 02/06/1999 02:19:44
Bob,

COW does indeed mean Copy On Write - this way we don't actually pay the 
cost of copying the page until we need to.

As for protecting page zero, that would break a lot of the MacROM glue
code that is still used for some things.  MacOS keeps a lot os system
globals down there, and many of the ROM routines read _and_ write to
them.  I know for sure that my SLOTMAN code would die a quick death if
page 0 were inaccessible.

On Fri, 5 Feb 1999, Bob Nestor wrote:

> While poking around trying to stumble over something that might be 
> causing the random panics some of us are seeing I noticed something in 
> machdep.c.  Most other ports have code in their machdep.c cpu_startup 
> that marks Page 0 as inaccessible and protects the memory space occupied 
> by the Kernel against writes.  The comments all seem to indicate this is 
> done to keep from doing a "COW" on the text segment.
> 
> Marking Page 0 as inaccessible makes sense since this would provide a 
> great way for trapping NULL pointers, i.e. program access thru address 0 
> causes an addressing error.
> 
> I'm not sure what the "COW" means (Copy On Write?), but it seems to make 
> sense to mark the Kernel as Read/Execute to keep stray writes in 
> ill-behaved code from taking the system down.
> 
> The real question is, why aren't we doing these things in the mac68k 
> port?  Is it because the ADB/MRG code might need to do writes to low-core 
> memory?  If so, could these protections be enabled for Kernels running 
> the non-MRG implementation?  Obviously this might cause problems for the 
> SLOTMAN kernels, but if this helps identify our random kernel panic it 
> might be a good thing in the short term.
> 
> thanks,
> -bob
> 
> 
> 
> 

-----------------------------------------------------------------------------
| Paul Goyette      | PGP DSS Key fingerprint:   | E-mail addresses:        |
| Network Engineer  |   BCD7 5301 9513 58A6 0DBC |  paul@whooppee.com       |
| and kernel hacker |   91EB ADB1 A280 3B79 9221 |  paul.goyette@ascend.com |
-----------------------------------------------------------------------------