Re: [RFC][PATCH 10/22] x86,uaccess: Remove .fixup usage

From: Josh Poimboeuf
Date: Thu Nov 04 2021 - 18:29:45 EST


On Thu, Nov 04, 2021 at 05:47:39PM +0100, Peter Zijlstra wrote:
> #define __get_user_asm_u64(x, ptr, retval) \
> - __get_user_asm(x, ptr, retval, "q", "=r")
> + __get_user_asm(x, ptr, retval, "q", "=a")
> #endif
>
> #define __get_user_size(x, ptr, size, retval) \
> @@ -379,14 +377,14 @@ do { \
> __chk_user_ptr(ptr); \
> switch (size) { \
> case 1: \
> - __get_user_asm(x_u8__, ptr, retval, "b", "=q"); \
> + __get_user_asm(x_u8__, ptr, retval, "b", "=a"); \
> (x) = x_u8__; \
> break; \
> case 2: \
> - __get_user_asm(x, ptr, retval, "w", "=r"); \
> + __get_user_asm(x, ptr, retval, "w", "=a"); \
> break; \
> case 4: \
> - __get_user_asm(x, ptr, retval, "l", "=r"); \
> + __get_user_asm(x, ptr, retval, "l", "=a"); \
> break; \
> case 8: \
> __get_user_asm_u64(x, ptr, retval); \
> @@ -400,16 +398,13 @@ do { \
> asm volatile("\n" \
> "1: mov"itype" %[umem],%[output]\n" \
> "2:\n" \
> - ".section .fixup,\"ax\"\n" \
> - "3: mov %[efault],%[errout]\n" \
> - " xorl %k[output],%k[output]\n" \
> - " jmp 2b\n" \
> - ".previous\n" \
> - _ASM_EXTABLE_UA(1b, 3b) \
> + _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_EFAULT_REG | \
> + EX_FLAG_CLR_AX, \
> + %[errout]) \
> : [errout] "=r" (err), \
> [output] ltype(x) \
> : [umem] "m" (__m(addr)), \
> - [efault] "i" (-EFAULT), "0" (err))
> + "0" (err))

Since this legacy __get_user_asm() now has a hard dependency on "=a",
might as well just make that explicit by hard-coding the constraint here
and removing the 'ltype' arg.

--
Josh