From: Gedare Bloom <gedare@rtems.org>
To: ratheesh kannoth <ratheesh.ksz@gmail.com>
Cc: linux-c-programming@vger.kernel.org, gcc-help@gcc.gnu.org
Subject: Re: c inline assembly
Date: Sun, 19 Feb 2012 11:46:46 -0500 [thread overview]
Message-ID: <CAC82fA3Anm7LRzq8z0HoAeEvy_ck=U9rc49WDddBZHR9f==0XA@mail.gmail.com> (raw)
In-Reply-To: <CAGZFCEH_NWJQid+DgOGrDp0nAS6odH2fLamT1k-vWP1ceAiMzQ@mail.gmail.com>
On Sat, Feb 18, 2012 at 1:01 AM, ratheesh kannoth
<ratheesh.ksz@gmail.com> wrote:
> I am using gcc on a 32bit intel machine. i have defined an inline function.
>
>
> This function is inline . what all registers needs to pushed and
> poped in the inline assembly so that the functions wont
> disturb the registers in the function ( in which it is C inlined ).
>
Use the clobber list:
http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#ss5.3
>
> inline unsigned long hello(unsigned long a)
>
> {
> int b;
> asm ("movl %1, %%eax;
> " movl %1, %%ebx;
> "movl %1, %%ecx;
> "movl %1, %%esi;
> "movl %1, %%edi;
>
> "movl %%eax, %0;"
> :"=r"(b) /* output */
> :"r"(a) /* input */
: "eax","ecx","esi","edi" /* clobber */
> );
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-02-19 16:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAGZFCEEaJ7ZsNAmWCF-nDtsjs70U7fqEVvTXEaCt9Tmk1dcemQ@mail.gmail.com>
2012-02-18 6:01 ` c inline assembly ratheesh kannoth
2012-02-19 5:14 ` Ian Lance Taylor
2012-02-19 16:46 ` Gedare Bloom [this message]
2012-02-18 6:26 Vladimir Murzin
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='CAC82fA3Anm7LRzq8z0HoAeEvy_ck=U9rc49WDddBZHR9f==0XA@mail.gmail.com' \
--to=gedare@rtems.org \
--cc=gcc-help@gcc.gnu.org \
--cc=linux-c-programming@vger.kernel.org \
--cc=ratheesh.ksz@gmail.com \
/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 NNTP newsgroup(s).