X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Fri, 23 Dec 2011 14:52:47 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: 16 byte pthread stack alignments
Message-ID: <20111223135247.GM31936@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <Pine.CYG.4.58.1112201743030.3964@PC1163-8460-XP.flightsafety.com> <20111221094211.GH23547@calimero.vinschen.de> <4EF1F937.9040107@gmail.com> <20111221154104.GB11841@calimero.vinschen.de> <Pine.CYG.4.58.1112211020000.3076@PC1163-8460-XP.flightsafety.com> <20111221165053.GA9699@calimero.vinschen.de> <Pine.CYG.4.58.1112221245050.748@PC1163-8460-XP.flightsafety.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <Pine.CYG.4.58.1112221245050.748@PC1163-8460-XP.flightsafety.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Dec 22 12:51, Brian Ford wrote:
> On Wed, 21 Dec 2011, Corinna Vinschen wrote:
> 
> > On second thought I'm a bit puzzled that the pthread stack isn't
> > correctly aligned as well.  Ignoring the pthread_attr_setstack case
> > which wasn't supported so far anyway, the OS stack set up by
> > CreateThread is 64K aligned.  From that 64K aligned StackBase value, I
> > subtract 12704 == 0x31a0 bytes.  So the result should be 16 byte
> > aligned even without the andl $-16, %%esp.  Why isn't it?!?
> 
> It appears it is, here.
> 
> > Does anybody care to tell me what's wrong with the assembler code in
> > thread_wrapper?
> 
> I don't pretend to understand why, but it appears gcc is expecting the
> stack to be 16 byte aligned on entry to the called function, which
> includes the 4 byte argument and the 4 byte return address in this case.
> I could be wrong, but it appears that would do it.

Sorry, but what I don't get from your reply is if the andl worked or
not.  Is the alignment correct now or do I have to move the stack down
by another 8 bytes to account for the argument and the stack address?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

