delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/01/08:54:08

Date: Thu, 1 Jun 2000 14:51:32 +0200 (MET DST)
From: Gisle Vanem <giva AT bgnett DOT no>
To: djgpp AT delorie DOT com
cc: eliz AT is DOT elta DOT co DOT il
Subject: Re: Inline asm: lcall & various binutils versions
Message-ID: <Pine.UW2.3.95.1000601145005.25970A-100000@bryggen.bgnett.no>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
 
> On Thu, 1 Jun 2000, Gisle Vanem wrote:
>
> > But I think he meant wrong alignment of
> > '__dpmi_paddr.selector'.  Without some #pragma's around '__dpmi_paddr',
> > the long-call *could* cause a crash.
>
> I'd prefer to solve this without #pragma's.  What exactly is wrong with
> the current layout of __dpmi_paddr, if used in an lcall?
 
"lcall (%%edi)" is an indexed far call. 'edi' must point to a 48-bit
address block. This block ('__dpmi_paddr') must have a layout as defined
by Intel for an indexed far call opcode.
 
First 32-bit must be a linear offset and immediatially followed by 16-bit
for a valid selector (bigendian layout).  If gcc should optimise and align
'__dpmi_paddr.selector' differently it would no longer be a valid selector
at that address.

What's wrong with #pragma's anyway? Most compilers support it (even
gcc). I much prefer '#pragma pack' over the IMHO messy
'__attribute__((packed))' construction.
 
Gisle V.

- Raw text -


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