aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/regset.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 761c931af975..8abee6556223 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,
318 return 0; 318 return 0;
319} 319}
320 320
321/**
322 * copy_regset_to_user - fetch a thread's user_regset data into user memory
323 * @target: thread to be examined
324 * @view: &struct user_regset_view describing user thread machine state
325 * @setno: index in @view->regsets
326 * @offset: offset into the regset data, in bytes
327 * @size: amount of data to copy, in bytes
328 * @data: user-mode pointer to copy into
329 */
330static inline int copy_regset_to_user(struct task_struct *target,
331 const struct user_regset_view *view,
332 unsigned int setno,
333 unsigned int offset, unsigned int size,
334 void __user *data)
335{
336 const struct user_regset *regset = &view->regsets[setno];
337
338 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO;
340
341 return regset->get(target, regset, offset, size, NULL, data);
342}
343
344/**
345 * copy_regset_from_user - store into thread's user_regset data from user memory
346 * @target: thread to be examined
347 * @view: &struct user_regset_view describing user thread machine state
348 * @setno: index in @view->regsets
349 * @offset: offset into the regset data, in bytes
350 * @size: amount of data to copy, in bytes
351 * @data: user-mode pointer to copy from
352 */
353static inline int copy_regset_from_user(struct task_struct *target,
354 const struct user_regset_view *view,
355 unsigned int setno,
356 unsigned int offset, unsigned int size,
357 const void __user *data)
358{
359 const struct user_regset *regset = &view->regsets[setno];
360
361 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO;
363
364 return regset->set(target, regset, offset, size, NULL, data);
365}
366
321 367
322#endif /* <linux/regset.h> */ 368#endif /* <linux/regset.h> */