www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/22/01:31:44

Newsgroups: comp.os.msdos.djgpp
From: Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca>
Subject: Re: Assembler Help!!
Message-ID: <Pine.SGI.3.91.970321092652.2672A-100000@atmosp.physics.utoronto.ca>
Nntp-Posting-Host: chinook.physics.utoronto.ca
Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator)
Mime-Version: 1.0
Organization: University of Toronto - Dept. of Physics
In-Reply-To: <Pine.SUN.3.91.970320180036.24420A-100000@is>
Date: Fri, 21 Mar 1997 14:36:38 GMT
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970320180036 DOT 24420A-100000 AT is>
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

- Raw text -


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