All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] fixing __xn_put_user and __xn_get_user for PowerPC
Date: Thu, 19 Oct 2006 22:25:43 +0200	[thread overview]
Message-ID: <4537DF47.8040800@domain.hid> (raw)

[-- 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

             reply	other threads:[~2006-10-19 20:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-19 20:25 Wolfgang Grandegger [this message]
2006-10-19 20:58 ` [Xenomai-core] [PATCH] fixing __xn_put_user and __xn_get_user for PowerPC Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4537DF47.8040800@domain.hid \
    --to=wg@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.