www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/07/21:25:20

From: "John S. Fine" <johnfine AT erols DOT com>
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: <E111riO-0006v0-00 DOT 1999-07-07-14-26-20 AT svr-a-04 DOT core DOT theplanet DOT net>
Mime-Version: 1.0
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/

- Raw text -


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