All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] fixing __xn_put_user and __xn_get_user for PowerPC
@ 2006-10-19 20:25 Wolfgang Grandegger
  2006-10-19 20:58 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Grandegger @ 2006-10-19 20:25 UTC (permalink / raw)
  To: xenomai-core

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

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.

[-- Attachment #2: xenomai-powerpc-put-get-user.patch --]
[-- Type: text/x-patch, Size: 2722 bytes --]

Index: include/asm-powerpc/syscall.h
===================================================================
--- include/asm-powerpc/syscall.h	(revision 1733)
+++ include/asm-powerpc/syscall.h	(working copy)
@@ -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)
Index: include/asm-powerpc/wrappers.h
===================================================================
--- include/asm-powerpc/wrappers.h	(revision 1733)
+++ include/asm-powerpc/wrappers.h	(working copy)
@@ -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 */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1733)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2006-10-19  Wolfgang Grandegger  <wg@domain.hid>
+
+	* 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  <jan.kiszka@domain.hid>
 
 	* configure.in, scripts/xeno-config.in: Reducing CFLAGS and LDFLAGS

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-19 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-19 20:25 [Xenomai-core] [PATCH] fixing __xn_put_user and __xn_get_user for PowerPC Wolfgang Grandegger
2006-10-19 20:58 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.