From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15412 invoked by alias); 9 Jun 2011 17:49:46 -0000 Received: (qmail 15403 invoked by uid 22791); 9 Jun 2011 17:49:45 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Jun 2011 17:49:31 +0000 Received: from kpbe14.cbf.corp.google.com (kpbe14.cbf.corp.google.com [172.25.105.78]) by smtp-out.google.com with ESMTP id p59HnTNt009237 for ; Thu, 9 Jun 2011 10:49:30 -0700 Received: from pwi12 (pwi12.prod.google.com [10.241.219.12]) by kpbe14.cbf.corp.google.com with ESMTP id p59HnRIJ004770 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 9 Jun 2011 10:49:28 -0700 Received: by pwi12 with SMTP id 12so1080096pwi.14 for ; Thu, 09 Jun 2011 10:49:27 -0700 (PDT) Received: by 10.68.15.129 with SMTP id x1mr524366pbc.49.1307641765681; Thu, 09 Jun 2011 10:49:25 -0700 (PDT) Received: from coign.google.com (dhcp-172-18-113-207.mtv.corp.google.com [172.18.113.207]) by mx.google.com with ESMTPS id b8sm1579316pbj.46.2011.06.09.10.49.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Jun 2011 10:49:24 -0700 (PDT) From: Ian Lance Taylor To: Daniel Mierswa Cc: gcc-help@gcc.gnu.org Subject: Re: Inline ASM and stack/base pointer References: <4DF0F706.5050803@impulze.org> Date: Thu, 09 Jun 2011 18:09:00 -0000 In-Reply-To: <4DF0F706.5050803@impulze.org> (Daniel Mierswa's message of "Thu, 09 Jun 2011 16:38:30 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00213.txt.bz2 Daniel Mierswa writes: > I was wondering how to overcome the issue that evolves when parameters > (inputs) to the inline assembly are passed relative to ebp/esp and > modifying those pointers in the inline assembly. Basically > __asm__("push %ecx\nmov %0, %edx\n"::"m"(variable)); could set '%0' to > 4(%esp) or similar which would no longer represent the same location > once I use push/pop in my asm. Is it possible to explicitly state that > GCC passes those relative to esp _or_ ebp so I can safely modify at > least one pointer (i.e. reserve stack space)? Or are there any other > ways to overcome this issue? Thanks in advance. Add "%esp" to your clobber list. That should force the compiler to pass any stack variables using an offset from %ebp. Ian