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()
49 /* current s->p must be aligned for v; v must be a scalar */
53 if (__s->left) { \
56 if (unlikely(__size > __s->left)) { \
57 __size = __s->left; \
58 memcpy(__s->p, &__v, __size); \
60 *(typeof(__v + 0) *)__s->p = __v; \
62 __s->p += __size; \
63 __s->left -= __size; \
65 __s->left;})
68 * user_regset_active_fn - type of @active function in &struct user_regset
72 * Return -%ENODEV if not available on the hardware found.
90 * user_regset_set_fn - type of @set function in &struct user_regset
95 * @kbuf: if not %NULL, a kernel-space pointer to copy from
96 * @ubuf: if @kbuf is %NULL, a user-space pointer to copy from
98 * Store register values. Return %0 on success; -%EIO or -%ENODEV
100 * bytes, but must be properly aligned. If @kbuf is non-null, that
102 * ubuf gives a userland pointer to access directly, and an -%EFAULT
111 * user_regset_writeback_fn - type of @writeback function in &struct user_regset
127 * Return %0 on success or if there was nothing to do, -%EFAULT for
128 * a memory problem (bad stack pointer or whatever), or -%EIO for a
136 * struct user_regset - accessible thread CPU state
150 * similar slots, given by @n. Each slot is @size bytes, and aligned to
151 * @align bytes (which is at least @size). For dynamically-sized
168 * The @pos argument must be aligned according to @align; the @count
183 * part of the per-machine ELF formats userland knows about. In
201 * struct user_regset_view - available regsets
213 * might refer to the same machine-specific state in the thread. For
214 * example, a 32-bit thread's state could be examined from the 32-bit
215 * view or from the 64-bit view. Either method reaches the same thread
229 * implementation is machine-dependent but its interface is universal.
232 * task_user_regset_view - Return the process's native regset view.
251 : min(*count, end_pos - *pos)); in user_regset_copyin()
252 data += *pos - start_pos; in user_regset_copyin()
257 return -EFAULT; in user_regset_copyin()
261 *count -= copy; in user_regset_copyin()
278 : min(*count, end_pos - *pos)); in user_regset_copyin_ignore()
284 *count -= copy; in user_regset_copyin_ignore()
304 * copy_regset_from_user - store into thread's user_regset data from user memory
307 * @setno: index in @view->regsets
310 * @data: user-mode pointer to copy from
318 const struct user_regset *regset = &view->regsets[setno]; in copy_regset_from_user()
320 if (!regset->set) in copy_regset_from_user()
321 return -EOPNOTSUPP; in copy_regset_from_user()
324 return -EFAULT; in copy_regset_from_user()
326 return regset->set(target, regset, offset, size, NULL, data); in copy_regset_from_user()