m68k/uaccess: Revive 64-bit get_user()

Revive support for 64-bit get_user(), which was disabled in commit
d94af931af ("[PATCH] m68k: clean up uaccess.h") due to a "broken"
typeof in (then brand new) gcc-4.1.

  - Keep on using u64 for the temporary, as __typeof__() doesn't drop
    the const qualifier,
  - Move it into a union (like mips32 does) to get rid of the cast, as
    using get_user() to fetch a __user pointer would cause a "cast to
    pointer from integer of different size" warning otherwise.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Martijn Coenen <maco@android.com>
This commit is contained in:
Geert Uytterhoeven 2018-05-14 15:33:14 +02:00
Родитель d8441ba80c
Коммит 7124330dab
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -141,10 +141,12 @@ asm volatile ("\n" \
case 4: \ case 4: \
__get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \ __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \
break; \ break; \
/* case 8: disabled because gcc-4.1 has a broken typeof \ case 8: { \
{ \
const void *__gu_ptr = (ptr); \ const void *__gu_ptr = (ptr); \
u64 __gu_val; \ union { \
u64 l; \
__typeof__(*(ptr)) t; \
} __gu_val; \
asm volatile ("\n" \ asm volatile ("\n" \
"1: "MOVES".l (%2)+,%1\n" \ "1: "MOVES".l (%2)+,%1\n" \
"2: "MOVES".l (%2),%R1\n" \ "2: "MOVES".l (%2),%R1\n" \
@ -162,13 +164,13 @@ asm volatile ("\n" \
" .long 1b,10b\n" \ " .long 1b,10b\n" \
" .long 2b,10b\n" \ " .long 2b,10b\n" \
" .previous" \ " .previous" \
: "+d" (__gu_err), "=&r" (__gu_val), \ : "+d" (__gu_err), "=&r" (__gu_val.l), \
"+a" (__gu_ptr) \ "+a" (__gu_ptr) \
: "i" (-EFAULT) \ : "i" (-EFAULT) \
: "memory"); \ : "memory"); \
(x) = (__force typeof(*(ptr)))__gu_val; \ (x) = __gu_val.t; \
break; \ break; \
} */ \ } \
default: \ default: \
__gu_err = __get_user_bad(); \ __gu_err = __get_user_bad(); \
break; \ break; \