Re: [tip:x86/mm] x86-32: Add support for 64bit get_user()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 07, 2013 at 03:19:51PM -0800, tip-bot for Ville Syrjälä wrote:
> Commit-ID:  96477b4cd705c5416346aef262b0a1116cfcdd80
> Gitweb:     http://git.kernel.org/tip/96477b4cd705c5416346aef262b0a1116cfcdd80
> Author:     Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> AuthorDate: Wed, 12 Dec 2012 13:34:03 +0200
> Committer:  H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
> CommitDate: Thu, 7 Feb 2013 15:07:28 -0800
> 
> x86-32: Add support for 64bit get_user()
> 
> Implement __get_user_8() for x86-32. It will return the
> 64-bit result in edx:eax register pair, and ecx is used
> to pass in the address and return the error value.
> 
> For consistency, change the register assignment for all
> other __get_user_x() variants, so that address is passed in
> ecx/rcx, the error value is returned in ecx/rcx, and eax/rax
> contains the actual value.
> 
> [ hpa: I modified the patch so that it does NOT change the calling
>   conventions for the existing callsites, this also means that the code
>   is completely unchanged for 64 bits.
> 
>   Instead, continue to use eax for address input/error output and use
>   the ecx:edx register pair for the output. ]
> 
> This is a partial refresh of a patch [1] by Jamie Lokier from
> 2004. Only the minimal changes to implement 64bit get_user()
> were picked from the original patch.
> 
> [1] http://article.gmane.org/gmane.linux.kernel/198823
> 
> Originally-by: Jamie Lokier <jamie@xxxxxxxxxxxxx>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Link:
> http://lkml.kernel.org/r/1355312043-11467-1-git-send-email-ville.syrjala@xxxxxxxxxxxxxxx
> Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
> ---
>  arch/x86/include/asm/uaccess.h  | 19 +++++++++++++++----
>  arch/x86/kernel/i386_ksyms_32.c |  1 +
>  arch/x86/lib/getuser.S          | 37 ++++++++++++++++++++++++++++++++-----
>  3 files changed, 48 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> index 1709801..1e96326 100644
> --- a/arch/x86/include/asm/uaccess.h
> +++ b/arch/x86/include/asm/uaccess.h
> @@ -151,8 +151,15 @@ extern int __get_user_bad(void);
>   * On error, the variable @x is set to zero.
>   */
>  #ifdef CONFIG_X86_32
> -#define __get_user_8(__ret_gu, __val_gu, ptr)				\
> -		__get_user_x(X, __ret_gu, __val_gu, ptr)
> +#define __get_user_8(ret, x, ptr)		      \
> +do {						      \
> +	register unsigned long long __xx asm("%edx"); \
> +	asm volatile("call __get_user_8"	      \
> +		     : "=a" (ret), "=r" (__xx)	      \
> +		     : "0" (ptr));		      \
> +	(x) = __xx;				      \
> +} while (0)

I'm no inline asm guy so I don't claim to know whether this always
works. I'll have to take your word for it. While gcc documentation
does mention explicit register variables, it doesn't tell you
anything about using multiple registers for one such variable.

-- 
Ville Syrjälä
Intel OTC
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux