Complete RV32 support for Linux (v2)

Changes from prior pull request:
Use unsigned comparison for valid syscall number in entry_32.S
On Thu, Dec 18, 2014 at 4:54 PM, Albert Ou <notifications@github.com> wrote:
>
> In arch/riscv/include/asm/uaccess.h
> <https://github.com/ucb-bar/riscv-linux/pull/9#discussion-diff-22078147>:
>
> > +			"	.dword 1b, 4b\n"		\
> > +			"	.dword 2b, 4b\n"		\
> > +			"	.previous"			\
> > +			: "+r" (err), "=r" (__lo), "=&r" (__hi) \
> > +			: "r" (ptr), "i" (-EFAULT));		\
> > +		(x) = (__typeof(x))(__typeof((x)-(x)))		\
> > +			(((u64)__hi << 32) | __lo);		\
> > +	})
> > +#else /* !CONFIG_MMU */
> > +#define __get_user_8(x, ptr, err)				\
> > +	({							\
> > +		unsigned int __lo, __hi;			\
> > +		__asm__ __volatile__ (				\
> > +			"lw %0, 0(%2)\n"			\
> > +			"lw %1, 4(%2)\n"			\
> > +			: "=r" (x)				\
>
> Looking at gcc/config/riscv/constraints.md in the current toolchain, I'm
> not sure that the r constraint automatically splits 64-bit values into
> the register pair %0 and %1. The closest analogue would be the A
> constraint from i386, but even it doesn't appear to support this behavior.
>
> @aswaterman <https://github.com/aswaterman>: Any thoughts on whether such
> a feature is possible/desirable versus simply doing (((u64)__hi << 32) |
> __lo)?
>
That kind of constraint makes more sense to me for x86, where the ISA
itself imposes restrictions on the registers that multi-word values end up
in.  Although ((u64)x<<32|y) is ugly, it is less opaque.  In any case, good
code is going to hide this complexity within a preprocessor macro, as is
the case here, so it shouldn't matter too much.  I'd just leave it as-is.

> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ucb-bar/riscv-linux/pull/9/files#r22078147>.
>