Lines Matching +full:left +full:- +full:aligned

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * User-mode machine state access
22 size_t left; member
27 if (s->left) { in membuf_zero()
28 if (size > s->left) in membuf_zero()
29 size = s->left; in membuf_zero()
30 memset(s->p, 0, size); in membuf_zero()
31 s->p += size; in membuf_zero()
32 s->left -= size; in membuf_zero()
34 return s->left; in membuf_zero()
39 if (s->left) { in membuf_write()
40 if (size > s->left) in membuf_write()
41 size = s->left; in membuf_write()
42 memcpy(s->p, v, size); in membuf_write()
43 s->p += size; in membuf_write()
44 s->left -= size; in membuf_write()
46 return s->left; in membuf_write()
53 if (offs > n.left) in membuf_at()
54 offs = n.left; in membuf_at()
56 n.left -= offs; in membuf_at()
61 /* current s->p must be aligned for v; v must be a scalar */
65 if (__s->left) { \
68 if (unlikely(__size > __s->left)) { \
69 __size = __s->left; \
70 memcpy(__s->p, &__v, __size); \
72 *(typeof(__v + 0) *)__s->p = __v; \
74 __s->p += __size; \
75 __s->left -= __size; \
77 __s->left;})
80 * user_regset_active_fn - type of @active function in &struct user_regset
84 * Return -%ENODEV if not available on the hardware found.
102 * user_regset_set_fn - type of @set function in &struct user_regset
107 * @kbuf: if not %NULL, a kernel-space pointer to copy from
108 * @ubuf: if @kbuf is %NULL, a user-space pointer to copy from
110 * Store register values. Return %0 on success; -%EIO or -%ENODEV
112 * bytes, but must be properly aligned. If @kbuf is non-null, that
114 * ubuf gives a userland pointer to access directly, and an -%EFAULT
123 * user_regset_writeback_fn - type of @writeback function in &struct user_regset
139 * Return %0 on success or if there was nothing to do, -%EFAULT for
140 * a memory problem (bad stack pointer or whatever), or -%EIO for a
148 * struct user_regset - accessible thread CPU state
162 * similar slots, given by @n. Each slot is @size bytes, and aligned to
163 * @align bytes (which is at least @size). For dynamically-sized
180 * The @pos argument must be aligned according to @align; the @count
195 * part of the per-machine ELF formats userland knows about. In
213 * struct user_regset_view - available regsets
225 * might refer to the same machine-specific state in the thread. For
226 * example, a 32-bit thread's state could be examined from the 32-bit
227 * view or from the 64-bit view. Either method reaches the same thread
241 * implementation is machine-dependent but its interface is universal.
244 * task_user_regset_view - Return the process's native regset view.
263 : min(*count, end_pos - *pos)); in user_regset_copyin()
264 data += *pos - start_pos; in user_regset_copyin()
269 return -EFAULT; in user_regset_copyin()
273 *count -= copy; in user_regset_copyin()
290 : min(*count, end_pos - *pos)); in user_regset_copyin_ignore()
296 *count -= copy; in user_regset_copyin_ignore()
316 * copy_regset_from_user - store into thread's user_regset data from user memory
319 * @setno: index in @view->regsets
322 * @data: user-mode pointer to copy from
330 const struct user_regset *regset = &view->regsets[setno]; in copy_regset_from_user()
332 if (!regset->set) in copy_regset_from_user()
333 return -EOPNOTSUPP; in copy_regset_from_user()
336 return -EFAULT; in copy_regset_from_user()
338 return regset->set(target, regset, offset, size, NULL, data); in copy_regset_from_user()