www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/11/13/12:54:40

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10411131756.AA83688@clio.rice.edu>
Subject: Re: Alignment problem on Windows XP
To: djgpp-workers AT delorie DOT com
Date: Sat, 13 Nov 2004 11:56:17 -0600 (CST)
In-Reply-To: <01c4c768$Blat.v2.2.2$4dcfb280@zahav.net.il> from "Eli Zaretskii" at Nov 10, 2004 10:59:24 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
X-Virus-Scanned: by amavis-20030616-p6 at mail.rice.edu
X-DCC--Metrics: handler11.mail.rice.edu 1066; Body=1 Fuz1=1 Fuz2=1
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> The short test program attached at the end of this message prints
> zero values on Windows 98, but a user who tried it on XP told me it
> printed "4", which means that __attribute__((__aligned__)) is not
> working on XP.
> 
> The assembly emitted by GCC is okay, so I suspect that the XP DPMI
> host somehow screws up our alignment.  Any ideas why this happens or
> how to overcome it?

> Btw, I tried to run the program on 2 XP boxes and one W2K box, and it
> behaved correctly (i.e. printed zeroes) on all of them.  Hmm...

I would first want to check the binary image used by the user with the
problem - it could be some installation problem that generates bad
executables?

The example problem has the data in BSS, so I don't see how it could
have any address offsets.

If the XP DPMI provider sometimes returns blocks with alignment less than
we assume, I think the selector base would fix this (it would run slowly,
but the offsets would all be correct).  Normally DPMI memory requests 
should be returned page granular if the provider supports virtual memory.

Since we allocate multiple memory blocks unless unixy sbrk is set, if 
XP chose to return a block with an offset of modulo 4 bytes alignment 
to the first block, all of the stuff in stack and/or sbrk() calls would
be at danger - we have code that tries to do alignment but I don't know
if it always works (probably not tested much).

- Raw text -


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