fixing __xn_put_user and __xn_get_user for PowerPC
PATCH 1/1 fixing __xn_put_user and __xn_get_user for PowerPC
Hello,
the attached patch fixes the problem described in the mail https://mail.gna.org/public/xenomai-core/2006-10/msg00037.html. Here is the ChangeLog entry:
* include/asm-powerpc/wrappers.h, include/asm-powerpc/syscall.h:
Since Linux 2.4.15, __put_user and __get_user call migth_sleep. To avoid that, wrapper functions have been added.
Wolfgang.
asm-powerpc/syscall.h +2 -2
@@ -57,8 +57,8 @@ ({ int __err__ = __copy_from_user_inatomic(dstP,srcP,n); __err__; })#define __xn_copy_to_user (task,dstP,srcP,n) \ ({ int __err__ = __copy_to_user_inatomic(dstP,srcP,n); __err__; }) -#define __xn_put_user (task,src,dstP) __put_user(src,dstP) -#define __xn_get_user (task,dst,srcP) __get_user(dst,srcP) +#define __xn_put_user (task,src,dstP) wrap_put_user(src,dstP) +#define __xn_get_user (task,dst,srcP) wrap_get_user(dst,srcP)#define __xn_strncpy_from_user (task,dstP,srcP,n) __strncpy_from_user(dstP,srcP,n)#define __xn_access_ok (task,type,addr,size) wrap_range_ok(task,addr,size)
asm-powerpc/wrappers.h +34 -0
@@ -49,4 +49,38 @@#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,15 ) + +#define wrap_put_user (src,dstP) __put_user(src,dstP) +#define wrap_get_user (dst,srcP) __get_user(dst,srcP) + +#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) */ + +/* from linux/include/asm-powerpc/uaccess.h */ +#define wrap_get_user (x, ptr) \ +({ \ + int __gu_size = sizeof(*(ptr)); \ + long __gu_err; \ + unsigned long __gu_val; \ + const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ + __chk_user_ptr(ptr); \ + __get_user_size(__gu_val, __gu_addr, gu_size, __gu_err);\ + (x) = (__typeof__(*(ptr)))__gu_val; \ + __gu_err; \ +}) + +#define wrap_put_user (x, ptr) \ +({ \ + int __pu_size = sizeof(*(ptr)); \ + long __pu_err; \ + __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ + __chk_user_ptr(ptr); \ + __put_user_size((__typeof__(*(ptr)))(x), \ + __pu_addr, __pu_size, __pu_err); \ + __pu_err; \ +}) + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) */ + +#endif /* _XENO_ASM_POWERPC_WRAPPERS_H */
ChangeLog +6 -0
@@ -1,3 +1,9 @@ +2006-10-19 Wolfgang Grandegger <[email protected]> + + * include/asm-powerpc/wrappers.h, include/asm-powerpc/syscall.h: + Since Linux 2.4.15, __put_user and __get_user call migth_sleep. + To avoid that, wrapper functions have been added. + 2006-10-18 Jan Kiszka <[email protected]> * configure.in, scripts/xeno-config.in: Reducing CFLAGS and LDFLAGS
Philippe Gerum
AppliedQuoted 10 lines · Wolfgang Grandegger
Hello,
the attached patch fixes the problem described in the mail
https://mail.gna.org/public/xenomai-core/2006-10/msg00037.html. Here is the ChangeLog entry:*
include/asm-powerpc/wrappers.h,include/asm-powerpc/syscall.h:
Since Linux 2.4.15,__put_userand__get_usercallmigth_sleep. To avoid that, wrapper functions have been added.
Merged, thanks.
Quoted 5 lines
Wolfgang.
_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core
Signature · 1 line
Philippe.