Mail Archives: djgpp/1997/03/22/01:31:44
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 -