Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5bde4d181793be84351bc21c256d8c71cfcd313a
Commit:     5bde4d181793be84351bc21c256d8c71cfcd313a
Parent:     b9d36d5d000294a128f7f174fe67623a10e29d61
Author:     Roland McGrath <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 13:31:47 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 13:31:47 2008 +0100

    x86: user_regset user-copy helpers
    
    This defines two new inlines in linux/regset.h, for use in arch_ptrace
    implementations and the like.  These provide simplified wrappers for using
    the user_regset interfaces to copy thread regset data into the caller's
    user-space memory.  The inlines are trivial, but make the common uses in
    places such as ptrace implementation much more concise, easier to read, and
    less prone to code-copying errors.
    
    Signed-off-by: Roland McGrath <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 include/linux/regset.h |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/include/linux/regset.h b/include/linux/regset.h
index 761c931..8abee65 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -318,5 +318,51 @@ static inline int user_regset_copyin_ignore(unsigned int 
*pos,
        return 0;
 }
 
+/**
+ * copy_regset_to_user - fetch a thread's user_regset data into user memory
+ * @target:    thread to be examined
+ * @view:      &struct user_regset_view describing user thread machine state
+ * @setno:     index in @view->regsets
+ * @offset:    offset into the regset data, in bytes
+ * @size:      amount of data to copy, in bytes
+ * @data:      user-mode pointer to copy into
+ */
+static inline int copy_regset_to_user(struct task_struct *target,
+                                     const struct user_regset_view *view,
+                                     unsigned int setno,
+                                     unsigned int offset, unsigned int size,
+                                     void __user *data)
+{
+       const struct user_regset *regset = &view->regsets[setno];
+
+       if (!access_ok(VERIFY_WRITE, data, size))
+               return -EIO;
+
+       return regset->get(target, regset, offset, size, NULL, data);
+}
+
+/**
+ * copy_regset_from_user - store into thread's user_regset data from user 
memory
+ * @target:    thread to be examined
+ * @view:      &struct user_regset_view describing user thread machine state
+ * @setno:     index in @view->regsets
+ * @offset:    offset into the regset data, in bytes
+ * @size:      amount of data to copy, in bytes
+ * @data:      user-mode pointer to copy from
+ */
+static inline int copy_regset_from_user(struct task_struct *target,
+                                       const struct user_regset_view *view,
+                                       unsigned int setno,
+                                       unsigned int offset, unsigned int size,
+                                       const void __user *data)
+{
+       const struct user_regset *regset = &view->regsets[setno];
+
+       if (!access_ok(VERIFY_READ, data, size))
+               return -EIO;
+
+       return regset->set(target, regset, offset, size, NULL, data);
+}
+
 
 #endif /* <linux/regset.h> */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to