1 // SPDX-License-Identifier: GPL-2.0-or-later 2 3 #include <linux/regset.h> 4 5 #include <asm/switch_to.h> 6 7 #include "ptrace-decl.h" 8 9 /* 10 * Regardless of transactions, 'fp_state' holds the current running 11 * value of all FPR registers and 'ckfp_state' holds the last checkpointed 12 * value of all FPR registers for the current transaction. 13 * 14 * Userspace interface buffer layout: 15 * 16 * struct data { 17 * u64 fpr[32]; 18 * u64 fpscr; 19 * }; 20 */ 21 int fpr_get(struct task_struct *target, const struct user_regset *regset, 22 unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) 23 { 24 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != 25 offsetof(struct thread_fp_state, fpr[32])); 26 27 flush_fp_to_thread(target); 28 29 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 30 &target->thread.fp_state, 0, -1); 31 } 32 33 /* 34 * Regardless of transactions, 'fp_state' holds the current running 35 * value of all FPR registers and 'ckfp_state' holds the last checkpointed 36 * value of all FPR registers for the current transaction. 37 * 38 * Userspace interface buffer layout: 39 * 40 * struct data { 41 * u64 fpr[32]; 42 * u64 fpscr; 43 * }; 44 * 45 */ 46 int fpr_set(struct task_struct *target, const struct user_regset *regset, 47 unsigned int pos, unsigned int count, 48 const void *kbuf, const void __user *ubuf) 49 { 50 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != 51 offsetof(struct thread_fp_state, fpr[32])); 52 53 flush_fp_to_thread(target); 54 55 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 56 &target->thread.fp_state, 0, -1); 57 } 58