13 #ifndef _LINUX_REGSET_H
14 #define _LINUX_REGSET_H 1
16 #include <linux/compiler.h>
17 #include <linux/types.h>
60 unsigned int pos,
unsigned int count,
61 void *kbuf,
void __user *ubuf);
81 unsigned int pos,
unsigned int count,
82 const void *kbuf,
const void __user *ubuf);
220 static inline int user_regset_copyout(
unsigned int *
pos,
unsigned int *
count,
222 void __user **ubuf,
const void *
data,
223 const int start_pos,
const int end_pos)
228 if (end_pos < 0 || *pos < end_pos) {
229 unsigned int copy = (end_pos < 0 ? *count
230 :
min(*count, end_pos - *pos));
231 data += *pos - start_pos;
233 memcpy(*kbuf, data, copy);
245 static inline int user_regset_copyin(
unsigned int *pos,
unsigned int *count,
247 const void __user **ubuf,
void *data,
248 const int start_pos,
const int end_pos)
253 if (end_pos < 0 || *pos < end_pos) {
254 unsigned int copy = (end_pos < 0 ? *count
255 :
min(*count, end_pos - *pos));
256 data += *pos - start_pos;
258 memcpy(data, *kbuf, copy);
274 static inline int user_regset_copyout_zero(
unsigned int *pos,
276 void **kbuf,
void __user **ubuf,
283 if (end_pos < 0 || *pos < end_pos) {
284 unsigned int copy = (end_pos < 0 ? *count
285 :
min(*count, end_pos - *pos));
299 static inline int user_regset_copyin_ignore(
unsigned int *pos,
302 const void __user **ubuf,
309 if (end_pos < 0 || *pos < end_pos) {
310 unsigned int copy = (end_pos < 0 ? *count
311 :
min(*count, end_pos - *pos));
345 return regset->
get(target, regset, offset, size,
NULL, data);
357 static inline int copy_regset_from_user(
struct task_struct *target,
360 unsigned int offset,
unsigned int size,
361 const void __user *data)
371 return regset->
set(target, regset, offset, size,
NULL, data);