Newsgroups: comp.os.msdos.djgpp From: Peter Berdeklis Subject: Re: Assembler Help!! Message-ID: Nntp-Posting-Host: chinook.physics.utoronto.ca Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator) Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: University of Toronto - Dept. of Physics In-Reply-To: Date: Fri, 21 Mar 1997 14:36:38 GMT References: Lines: 41 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Thu, 20 Mar 1997, Eli Zaretskii wrote: > > On Mon, 17 Mar 1997, Francesco Marcelloni wrote: > > > I'd like to refer j or d by a selector register as, for instance, "%gs : > > j" (as written in the "as" manual). How is it possible to load in gs the > > address of section proof1? > > I'm far from being an assembly wizard, but since nobody has yet given > you any replies, I'll try, and let others correct me if I'm wrong. > > The DJGPP FAQ list says this in section 17.1: > > * The AT&T assembler does not provide support for multiple-section (aka > multi-segment) programs. Unix style systems expect all programs to be > single-section. > > So it seems that you can't do what you want, unless you hack some of > the tools involved (don't ask me how, I wouldn't know). Actually, GAS does accept segment prefixes, but doesn't actually compile them correctly. What you need to do is insert the segment override prefix byte by hand, e.g. .byte 0x2E # segment override for CS movl _memory, %eax # now _memory is an offset into the CS segment This is the technique used in the library code. The segment override bytes for all of the segment registers are as follows: CS - 0x2E DS - 0x3E ES - 0x26 FS - 0x64 GS - 0x65 SS - 0x36 --------------- Peter Berdeklis Dept. of Physics, Univ. of Toronto