Date: Sun, 22 Mar 1998 16:07:03 +0300 (IDT) From: Eli Zaretskii To: Nate Eldredge cc: Charles Sandmann , cssl AT geocities DOT com, djgpp-workers AT delorie DOT com Subject: Re: Can the text section be made read-only? In-Reply-To: <199803220136.RAA16736@adit.ap.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sat, 21 Mar 1998, Nate Eldredge wrote: > >But the core issue on all of this is moving the writable variables > >in exceptn.s out of the text section... there is no way to > >implement it without doing that first. > > Is that as simple as just adding `.data' before them and `.text' after? It > looks like it is (the code that locks them doesn't seem to care where they > are), but I'm not sure. I believe adding .data is not enough. The problem which caused these variables be inside .text is that when a signal is pending, the DS selector is invalid (that's how the DJGPP signals are scheduled to run once the program is back in its foreground execution task). Moving the variables to .data requires that the interrupt handlers on exceptn.S first set DS to the correct selector using the DS alias. Charles, am I right here? Does the code on exceptn.S need to restore the (invalid) DS before it exits, so as not to break signals mechanism? I would also suggest to look through library sources for other modules that assume these variables are in the CS segment. I'm not sure exceptn.S is the only one. The startup code and the stub would be the first places to look.