delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/25/19:25:40

From: Richard Dawe <richdawe AT bigfoot DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Inline asm: lcall & various binutils versions
Date: Tue, 25 Apr 2000 21:48:21 +0100
Organization: Customer of Planet Online
Lines: 64
Message-ID: <39060495.8CA597B0@bigfoot.com>
NNTP-Posting-Host: modem-88.argon.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg4.svr.pol.co.uk 956698207 17366 62.136.17.88 (25 Apr 2000 21:30:07 GMT)
NNTP-Posting-Date: 25 Apr 2000 21:30:07 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

I'm trying to get libsocket to be buildable with the following versions of
binutils (& gcc):

binutils 2.8.1 (gcc 2.95.2)
binutils 2.9.5.1 beta (gcc 2.95.2)
cross-binutils 2.9.1.0.4 (cross-egcs 1.1.2 aka 2.91.66 19990314) on Linux

libsocket uses INT 0x2F, subfunction 0x1684 to obtain the entry point of
WSOCK.VXD. This is stored in an array of type int[2] (*). Once the
entry-point has been obtained, the VxD is called using inline assembly's
lcall mnemonic. Here's some pseudo-code:

int entrypoint[2];

get_entry_point("WSOCK.VXD", entrypoint);

__asm__("\n\
         ...
         lcall _entrypoint \n\
         ...
        ");

get_entry_point() places ES:DI from the INT call into entrypoint[1] and
entrypoint[0] respectively.

(*) This array may be too big in total byte-size, but it works. When I
change it to a short, GPFs are generated. I wonder if this is because INT
0x2F, subfunction 0x1684 returns a selector:offset pair in protected mode,
i.e. 16-bit:32-bit, whereas it returns 16-bit:16-bit in real mode (as
listed in Ralph Brown's Interrupt List).

My first problem is this: binutils 2.8.1 & cross-binutils 2.9.1.0.4 were
happy with the 'lcall _entrypoint' syntax. binutils 2.9.5.1 beta is OK,
but warns that without a '*' the address is a relative address. With the
'lcall *_entrypoint' syntax, to use an absolute address, binutils 2.8.1
and cross-binutils 2.9.1.0.4 complain that this does not represent a known
Intel instruction (binutils 2.9.5.1 beta is happy and then code works).
What syntax should I use? Should this be a far call (i.e. lcall rather
than call)? Should I instead use a syntax like:

lcall *_entrypoint[1]:_entrypoint[0]

I guess I should I move away from a two-int structure to something like
this:

struct entrypoint {
    short selector;
    int offset;
};

I am hoping some of the asm wizards on this group can help me out here.
I've read the info docs for as & the asm guides I have, but I am clueless
here.

This difference in syntax acceptance is a bit of a mess really. Is there
some kind of 'gcc & binutils syntax gotchas FAQ'?

Thanks in advance for any help, bye,

-- 
Richard Dawe
richdawe AT bigfoot DOT com ICQ 47595498 http://www.bigfoot.com/~richdawe/

- Raw text -


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