public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Daniel Mierswa <impulze@impulze.org>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Inline ASM and stack/base pointer
Date: Thu, 09 Jun 2011 18:09:00 -0000	[thread overview]
Message-ID: <mcrr5723nfg.fsf@coign.corp.google.com> (raw)
In-Reply-To: <4DF0F706.5050803@impulze.org> (Daniel Mierswa's message of "Thu,	09 Jun 2011 16:38:30 +0000")

Daniel Mierswa <impulze@impulze.org> 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

  reply	other threads:[~2011-06-09 17:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 15:22 Daniel Mierswa
2011-06-09 18:09 ` Ian Lance Taylor [this message]
2011-06-09 18:47   ` kevin diggs
2011-06-09 19:53     ` Ian Lance Taylor
2011-06-09 20:26   ` Daniel Mierswa
2011-06-09 20:41   ` Daniel Mierswa
     [not found]     ` <BANLkTikg+N_E=OYU-wU2Od=2rsh=K=Ktsg@mail.gmail.com>
2011-06-09 23:12       ` Daniel Mierswa
2011-06-10  1:21         ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrr5723nfg.fsf@coign.corp.google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=impulze@impulze.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).