On Wed, Nov 8, 2017 at 6:55 AM, Greentime Hu <green...@gmail.com> wrote:
> +#define get_user(x,p) \ > + ({ \ > + const register typeof(*(p)) __user *__p asm("$r0") = (p);\ > + register unsigned long __r2 asm("$r2"); \ > + register int __e asm("$r0"); \ > + switch (sizeof(*(__p))) { \ > + case 1: \ > + __get_user_x(__r2, __p, __e, 1, "$lp"); \ > + break; \ > + case 2: \ > + __get_user_x(__r2, __p, __e, 2, "$lp"); \ > + break; \ > + case 4: \ > + __get_user_x(__r2, __p, __e, 4, "$lp"); \ > + break; \ > + case 8: \ > + __get_user_x(__r2, __p, __e, 8, "$r3", "$lp"); \ > + break; \ > + default: __e = __get_user_bad(); break; \ > + } \ > + x = (typeof(*(p))) __r2; \ > + __e; \ > + }) Something looks odd here: __get_user_bad above looks like it is meant to provide a link-time error > +__get_user_bad_8: > + move $r3, #0 > +__get_user_bad: > + move $r2, #0 > + move $r0, #-EFAULT > + ret > + but here you actually have a symbol with that name, it gets turned into a runtime error. I think the first one needs to get renamed to actually work as expected and force the link error in built-in code (it works in modules ins __get_user_bad is not exported). > + > +__put_user_bad: > + move $r0, #-EFAULT > + ret > + same here. Arnd