Mail Archives: djgpp/1999/07/07/21:25:20
englbert AT email DOT com wrote:
> I am planning to make _two_
> segments in protected mode. Each of which, will be two seperate segments, both
> with the start for addressing at zero. One will hold the program, and the other
> will hold the data for the program. This was, the program will not be able to
> overwrite program code by accident, as the data pointers will point to a
> different segment.
I think you better check what GCC does with various kinds of read-only
data. I think there are cases where read-only data is placed in the
code segment but accessed with the DS register rather than the CS
register. That would malfunction if CS and DS don't have the same
base.
Try coding a large switch statement. GCC will create a data table to
control the switch statement. I think that data table will reside in
code space but be accessed by DS.
There may be a command line switch that controls that behavior; I
don't remember.
I think using paging to write-protect the code and the read-only data
is a better method than using different segment bases.
--
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/
- Raw text -