From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: How to change Executable format to my own? Date: 9 Jul 1999 22:02:36 GMT Organization: University of Lulea, Sweden Lines: 27 Message-ID: <7m5rhs$see$2@news.luth.se> References: <01bec8e6$ccdcac80$LocalHost AT thendren> NNTP-Posting-Host: queeg.ludd.luth.se X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Christopher Nelson (paradox AT gye DOT satnet DOT net) wrote: : >Sorry, I don't understand. How can two sections begin at the same : >address (zero)? : : : intel x86 architecture allows using segment registers for separate data, : code, stack, and 2 extra segments. each segment may have it's own base, so : in a fully segmented architecture, it's completely allowable to have data : AND code a 0. : : 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. Skunk Anansie, Paranoid & Sunburnt, MartinS