mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Manfred Spraul <manfred@colorfullife.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Richard Henderson <rth@twiddle.net>, Ingo Molnar <mingo@elte.hu>
Subject: Re: out-of-line x86 "put_user()" implementation
Date: Fri, 11 Feb 2005 20:55:16 -0500	[thread overview]
Message-ID: <200502112058_MC3-1-95CC-5FF1@compuserve.com> (raw)

On Tue, 8 Feb 2005 at 18:27:08 -0800, Linus Torvalds wrote:

> +/*
> + * Strange magic calling convention: pointer in %ecx,
> + * value in %eax(:%edx), return value in %eax, no clobbers.
> + */
> +extern void __put_user_1(void);
> +extern void __put_user_2(void);
> +extern void __put_user_4(void);
> +extern void __put_user_8(void);
> +
> +#define __put_user_1(x, ptr) __asm__ __volatile__("call __put_user_1":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))
> +#define __put_user_2(x, ptr) __asm__ __volatile__("call __put_user_2":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))
> +#define __put_user_4(x, ptr) __asm__ __volatile__("call __put_user_4":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))
> +#define __put_user_8(x, ptr) __asm__ __volatile__("call __put_user_8":"=a" (__ret_pu):"A" ((typeof(*(ptr)))(x)), "c" (ptr))
> +#define __put_user_X(x, ptr) __asm__ __volatile__("call __put_user_X":"=a" (__ret_pu):"c" (ptr))
> +

  Should "cc" be on the clobber list since all the called functions alter EFLAGS?

  And in any case is it too much to ask for an 80-column limit? ;)

#define __put_user_1(x, ptr)                    \
__asm__ __volatile__(                           \
        "call __put_user_1"                     \
        : "=a" (__ret_pu)                       \
        : "0" ((typeof(*(ptr)))(x)), "c" (ptr)  \
        : "cc")
#define __put_user_2(x, ptr)                    \
__asm__ __volatile__(                           \
        "call __put_user_2"                     \
        : "=a" (__ret_pu)                       \
        : "0" ((typeof(*(ptr)))(x)), "c" (ptr)  \
        : "cc")
#define __put_user_4(x, ptr)                    \
__asm__ __volatile__(                           \
        "call __put_user_4"                     \
        : "=a" (__ret_pu)                       \
        : "0" ((typeof(*(ptr)))(x)), "c" (ptr)  \
        : "cc")
#define __put_user_8(x, ptr)                    \
__asm__ __volatile__(                           \
        "call __put_user_8"                     \
        : "=a" (__ret_pu)                       \
        : "A" ((typeof(*(ptr)))(x)), "c" (ptr)  \
        : "cc")
#define __put_user_X(x, ptr)                    \
__asm__ __volatile__(                           \
        "call __put_user_X"                     \
        : "=a" (__ret_pu)                       \
        : "c" (ptr)                             \
        : "cc")

--
Chuck

             reply	other threads:[~2005-02-12  1:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-12  1:55 Chuck Ebbert [this message]
2005-02-12  2:03 ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2005-02-07  6:23 Linus Torvalds
2005-02-07 11:44 ` Ingo Molnar
2005-02-08  1:20   ` Linus Torvalds
2005-02-08 17:43     ` Pavel Machek
2005-02-08 19:35     ` Valdis.Kletnieks
2005-02-09  1:25     ` Richard Henderson
2005-02-09  2:08       ` Linus Torvalds
2005-02-09  2:24         ` Andrew Morton
2005-02-09  2:32           ` Linus Torvalds
2005-02-09  1:27     ` Richard Henderson
2005-02-09  2:16       ` Linus Torvalds
2005-02-09  2:27         ` Linus Torvalds
2005-02-09  2:33           ` Richard Henderson
2005-02-11 22:15             ` H. Peter Anvin
2005-02-09  2:36         ` Richard Henderson
2005-03-12 14:55 ` Coywolf Qi Hunt

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=200502112058_MC3-1-95CC-5FF1@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=mingo@elte.hu \
    --cc=rth@twiddle.net \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®