delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/10/14:52:14

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: How to change Executable format to my own?
Date: Sat, 10 Jul 1999 10:07:50 -0600
Message-ID: <01becaee$5baacce0$d6780ed1@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com


>: alternatively, for DJGPP programs used as boot-loaders, or for operating
>: systems, you can have the compiler stick stuff where it wants to, then
>: subtract the data segment base to assume a base of 0.  from there it is
>: simply neccessary to properly initizlise the DS segment selector
properly,
>: and you have 0-based data.  since code is already at 0, you can just
stick
>: it in another similiar, but code-marked, segment.
>
>But it's run in protected mode so the segments are selectors. Now
>different selectors can point to diffent places, but if you point them
>both at base=0, and expect code at address 0 not interfere with data
>at address 0, I think you're misstaken. But I'm not an assembly guy,
>so I could be wrong. Please correct me if so.


acoording to the Intel Systems Programming Manual, the correct term is
segment selector.  it's the same difference anyway.  it's still a segment,
it's just not a real-mode segment.  the difference is that a protected-mode
segment has a linear address that maps to a logical address that maps to a
physical address.  because of all that mapping, you can stick stuff
whereever you want - so long as you get the link-ups correct.

you  cannot ever have a 0 selector.  the 0 selector defines an exception,
and will cause problems.  HOWEVER, you CAN have a selector whose BASE is 0.
this is what the author of the original message meant, and it is very simple
to do.  the only problem is that, if you use DJGPP to do it, you have to
relocate the data section DOWN whatever it's offset is.

    -={C}=-

- Raw text -


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