From: "John S. Fine" Newsgroups: comp.os.msdos.djgpp Subject: Re: How to change Executable format to my own? Date: Wed, 07 Jul 1999 10:55:06 -0400 Lines: 28 Message-ID: <378366FF.565F@erols.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ST6pSn/WhKiOHoeWKaslIos3AR3QzrMXcD0IrN6Pypo= X-Complaints-To: abuse AT rcn DOT com NNTP-Posting-Date: 7 Jul 1999 15:20:01 GMT X-Mailer: Mozilla 3.01 (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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/