delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/14/22:50:20

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <9803150344.AA13775@clio.rice.edu>
Subject: Re: Can the text section be made read-only?
To: eldredge AT ap DOT net (Nate Eldredge)
Date: Sat, 14 Mar 1998 21:44:59 -0600 (CST)
Cc: djgpp-workers AT delorie DOT com
In-Reply-To: <199803150138.RAA29732@adit.ap.net> from "Nate Eldredge" at Mar 14, 98 05:38:40 pm

> I think it would be a good idea if the text section were read-only.
> ...
> I've looked at it, and it seems the only thing stopping it are some
> variables in crt0.S that are placed in the text section. I think Charles
> once explained why they're there, but I've forgotten. There ought to be some
> other way of doing it. After that, of course, it's just a matter of placing
> an `mprotect' call or equivalent somewhere in the startup code.

Everything you say is correct.  I originally had plans for allowing the
text section to be read-only as an option.  

The reason the variables are in the text section was to make the keyboard
interrupt handler easier to lock.  All the code and variables used need
to be locked - and putting them together allowed a single lock call.  It
would not be hard to put the variables in the data section and then add
a second lock call.  It would have made some of the DLL stuff easier,
allowed for read-only text, etc.

But the problem is - mprotect and read only pages will only be supported
under CWSDPMI and 386MAX.  I'm not even 100% sure read-only pages will
page in/out properly under CWSDPMI.  And if it is supported, you just
*KNOW* you will get a whole bunch more messages about page fault errors
under DOS, so CWSDPMI must be broken since it works under Windoze ;-P

Just remember - no good deed goes unpunished! :-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019