Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / powerpc / kernel / ptrace / ptrace-tm.c
blob44045363a9035ce6d77798e04936db3438a9bd50
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include <linux/regset.h>
5 #include <asm/switch_to.h>
6 #include <asm/tm.h>
7 #include <asm/asm-prototypes.h>
9 #include "ptrace-decl.h"
11 void flush_tmregs_to_thread(struct task_struct *tsk)
14 * If task is not current, it will have been flushed already to
15 * it's thread_struct during __switch_to().
17 * A reclaim flushes ALL the state or if not in TM save TM SPRs
18 * in the appropriate thread structures from live.
21 if (!cpu_has_feature(CPU_FTR_TM) || tsk != current)
22 return;
24 if (MSR_TM_SUSPENDED(mfmsr())) {
25 tm_reclaim_current(TM_CAUSE_SIGNAL);
26 } else {
27 tm_enable();
28 tm_save_sprs(&tsk->thread);
32 static unsigned long get_user_ckpt_msr(struct task_struct *task)
34 return task->thread.ckpt_regs.msr | task->thread.fpexc_mode;
37 static int set_user_ckpt_msr(struct task_struct *task, unsigned long msr)
39 task->thread.ckpt_regs.msr &= ~MSR_DEBUGCHANGE;
40 task->thread.ckpt_regs.msr |= msr & MSR_DEBUGCHANGE;
41 return 0;
44 static int set_user_ckpt_trap(struct task_struct *task, unsigned long trap)
46 set_trap(&task->thread.ckpt_regs, trap);
47 return 0;
50 /**
51 * tm_cgpr_active - get active number of registers in CGPR
52 * @target: The target task.
53 * @regset: The user regset structure.
55 * This function checks for the active number of available
56 * regisers in transaction checkpointed GPR category.
58 int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset)
60 if (!cpu_has_feature(CPU_FTR_TM))
61 return -ENODEV;
63 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
64 return 0;
66 return regset->n;
69 /**
70 * tm_cgpr_get - get CGPR registers
71 * @target: The target task.
72 * @regset: The user regset structure.
73 * @to: Destination of copy.
75 * This function gets transaction checkpointed GPR registers.
77 * When the transaction is active, 'ckpt_regs' holds all the checkpointed
78 * GPR register values for the current transaction to fall back on if it
79 * aborts in between. This function gets those checkpointed GPR registers.
80 * The userspace interface buffer layout is as follows.
82 * struct data {
83 * struct pt_regs ckpt_regs;
84 * };
86 int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
87 struct membuf to)
89 struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr));
90 #ifdef CONFIG_PPC64
91 struct membuf to_softe = membuf_at(&to, offsetof(struct pt_regs, softe));
92 #endif
94 if (!cpu_has_feature(CPU_FTR_TM))
95 return -ENODEV;
97 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
98 return -ENODATA;
100 flush_tmregs_to_thread(target);
101 flush_fp_to_thread(target);
102 flush_altivec_to_thread(target);
104 membuf_write(&to, &target->thread.ckpt_regs, sizeof(struct user_pt_regs));
106 membuf_store(&to_msr, get_user_ckpt_msr(target));
107 #ifdef CONFIG_PPC64
108 membuf_store(&to_softe, 0x1ul);
109 #endif
110 return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
111 sizeof(struct user_pt_regs));
115 * tm_cgpr_set - set the CGPR registers
116 * @target: The target task.
117 * @regset: The user regset structure.
118 * @pos: The buffer position.
119 * @count: Number of bytes to copy.
120 * @kbuf: Kernel buffer to copy into.
121 * @ubuf: User buffer to copy from.
123 * This function sets in transaction checkpointed GPR registers.
125 * When the transaction is active, 'ckpt_regs' holds the checkpointed
126 * GPR register values for the current transaction to fall back on if it
127 * aborts in between. This function sets those checkpointed GPR registers.
128 * The userspace interface buffer layout is as follows.
130 * struct data {
131 * struct pt_regs ckpt_regs;
132 * };
134 int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset,
135 unsigned int pos, unsigned int count,
136 const void *kbuf, const void __user *ubuf)
138 unsigned long reg;
139 int ret;
141 if (!cpu_has_feature(CPU_FTR_TM))
142 return -ENODEV;
144 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
145 return -ENODATA;
147 flush_tmregs_to_thread(target);
148 flush_fp_to_thread(target);
149 flush_altivec_to_thread(target);
151 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
152 &target->thread.ckpt_regs,
153 0, PT_MSR * sizeof(reg));
155 if (!ret && count > 0) {
156 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &reg,
157 PT_MSR * sizeof(reg),
158 (PT_MSR + 1) * sizeof(reg));
159 if (!ret)
160 ret = set_user_ckpt_msr(target, reg);
163 BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
164 offsetof(struct pt_regs, msr) + sizeof(long));
166 if (!ret)
167 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
168 &target->thread.ckpt_regs.orig_gpr3,
169 PT_ORIG_R3 * sizeof(reg),
170 (PT_MAX_PUT_REG + 1) * sizeof(reg));
172 if (PT_MAX_PUT_REG + 1 < PT_TRAP && !ret)
173 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
174 (PT_MAX_PUT_REG + 1) * sizeof(reg),
175 PT_TRAP * sizeof(reg));
177 if (!ret && count > 0) {
178 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &reg,
179 PT_TRAP * sizeof(reg),
180 (PT_TRAP + 1) * sizeof(reg));
181 if (!ret)
182 ret = set_user_ckpt_trap(target, reg);
185 if (!ret)
186 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
187 (PT_TRAP + 1) * sizeof(reg), -1);
189 return ret;
193 * tm_cfpr_active - get active number of registers in CFPR
194 * @target: The target task.
195 * @regset: The user regset structure.
197 * This function checks for the active number of available
198 * regisers in transaction checkpointed FPR category.
200 int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset)
202 if (!cpu_has_feature(CPU_FTR_TM))
203 return -ENODEV;
205 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
206 return 0;
208 return regset->n;
212 * tm_cfpr_get - get CFPR registers
213 * @target: The target task.
214 * @regset: The user regset structure.
215 * @to: Destination of copy.
217 * This function gets in transaction checkpointed FPR registers.
219 * When the transaction is active 'ckfp_state' holds the checkpointed
220 * values for the current transaction to fall back on if it aborts
221 * in between. This function gets those checkpointed FPR registers.
222 * The userspace interface buffer layout is as follows.
224 * struct data {
225 * u64 fpr[32];
226 * u64 fpscr;
229 int tm_cfpr_get(struct task_struct *target, const struct user_regset *regset,
230 struct membuf to)
232 u64 buf[33];
233 int i;
235 if (!cpu_has_feature(CPU_FTR_TM))
236 return -ENODEV;
238 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
239 return -ENODATA;
241 flush_tmregs_to_thread(target);
242 flush_fp_to_thread(target);
243 flush_altivec_to_thread(target);
245 /* copy to local buffer then write that out */
246 for (i = 0; i < 32 ; i++)
247 buf[i] = target->thread.TS_CKFPR(i);
248 buf[32] = target->thread.ckfp_state.fpscr;
249 return membuf_write(&to, buf, sizeof(buf));
253 * tm_cfpr_set - set CFPR registers
254 * @target: The target task.
255 * @regset: The user regset structure.
256 * @pos: The buffer position.
257 * @count: Number of bytes to copy.
258 * @kbuf: Kernel buffer to copy into.
259 * @ubuf: User buffer to copy from.
261 * This function sets in transaction checkpointed FPR registers.
263 * When the transaction is active 'ckfp_state' holds the checkpointed
264 * FPR register values for the current transaction to fall back on
265 * if it aborts in between. This function sets these checkpointed
266 * FPR registers. The userspace interface buffer layout is as follows.
268 * struct data {
269 * u64 fpr[32];
270 * u64 fpscr;
273 int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset,
274 unsigned int pos, unsigned int count,
275 const void *kbuf, const void __user *ubuf)
277 u64 buf[33];
278 int i;
280 if (!cpu_has_feature(CPU_FTR_TM))
281 return -ENODEV;
283 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
284 return -ENODATA;
286 flush_tmregs_to_thread(target);
287 flush_fp_to_thread(target);
288 flush_altivec_to_thread(target);
290 for (i = 0; i < 32; i++)
291 buf[i] = target->thread.TS_CKFPR(i);
292 buf[32] = target->thread.ckfp_state.fpscr;
294 /* copy to local buffer then write that out */
295 i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1);
296 if (i)
297 return i;
298 for (i = 0; i < 32 ; i++)
299 target->thread.TS_CKFPR(i) = buf[i];
300 target->thread.ckfp_state.fpscr = buf[32];
301 return 0;
305 * tm_cvmx_active - get active number of registers in CVMX
306 * @target: The target task.
307 * @regset: The user regset structure.
309 * This function checks for the active number of available
310 * regisers in checkpointed VMX category.
312 int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset)
314 if (!cpu_has_feature(CPU_FTR_TM))
315 return -ENODEV;
317 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
318 return 0;
320 return regset->n;
324 * tm_cvmx_get - get CMVX registers
325 * @target: The target task.
326 * @regset: The user regset structure.
327 * @to: Destination of copy.
329 * This function gets in transaction checkpointed VMX registers.
331 * When the transaction is active 'ckvr_state' and 'ckvrsave' hold
332 * the checkpointed values for the current transaction to fall
333 * back on if it aborts in between. The userspace interface buffer
334 * layout is as follows.
336 * struct data {
337 * vector128 vr[32];
338 * vector128 vscr;
339 * vector128 vrsave;
342 int tm_cvmx_get(struct task_struct *target, const struct user_regset *regset,
343 struct membuf to)
345 union {
346 elf_vrreg_t reg;
347 u32 word;
348 } vrsave;
349 BUILD_BUG_ON(TVSO(vscr) != TVSO(vr[32]));
351 if (!cpu_has_feature(CPU_FTR_TM))
352 return -ENODEV;
354 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
355 return -ENODATA;
357 /* Flush the state */
358 flush_tmregs_to_thread(target);
359 flush_fp_to_thread(target);
360 flush_altivec_to_thread(target);
362 membuf_write(&to, &target->thread.ckvr_state, 33 * sizeof(vector128));
364 * Copy out only the low-order word of vrsave.
366 memset(&vrsave, 0, sizeof(vrsave));
367 vrsave.word = target->thread.ckvrsave;
368 return membuf_write(&to, &vrsave, sizeof(vrsave));
372 * tm_cvmx_set - set CMVX registers
373 * @target: The target task.
374 * @regset: The user regset structure.
375 * @pos: The buffer position.
376 * @count: Number of bytes to copy.
377 * @kbuf: Kernel buffer to copy into.
378 * @ubuf: User buffer to copy from.
380 * This function sets in transaction checkpointed VMX registers.
382 * When the transaction is active 'ckvr_state' and 'ckvrsave' hold
383 * the checkpointed values for the current transaction to fall
384 * back on if it aborts in between. The userspace interface buffer
385 * layout is as follows.
387 * struct data {
388 * vector128 vr[32];
389 * vector128 vscr;
390 * vector128 vrsave;
393 int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset,
394 unsigned int pos, unsigned int count,
395 const void *kbuf, const void __user *ubuf)
397 int ret;
399 BUILD_BUG_ON(TVSO(vscr) != TVSO(vr[32]));
401 if (!cpu_has_feature(CPU_FTR_TM))
402 return -ENODEV;
404 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
405 return -ENODATA;
407 flush_tmregs_to_thread(target);
408 flush_fp_to_thread(target);
409 flush_altivec_to_thread(target);
411 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ckvr_state,
412 0, 33 * sizeof(vector128));
413 if (!ret && count > 0) {
415 * We use only the low-order word of vrsave.
417 union {
418 elf_vrreg_t reg;
419 u32 word;
420 } vrsave;
421 memset(&vrsave, 0, sizeof(vrsave));
422 vrsave.word = target->thread.ckvrsave;
423 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &vrsave,
424 33 * sizeof(vector128), -1);
425 if (!ret)
426 target->thread.ckvrsave = vrsave.word;
429 return ret;
433 * tm_cvsx_active - get active number of registers in CVSX
434 * @target: The target task.
435 * @regset: The user regset structure.
437 * This function checks for the active number of available
438 * regisers in transaction checkpointed VSX category.
440 int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset)
442 if (!cpu_has_feature(CPU_FTR_TM))
443 return -ENODEV;
445 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
446 return 0;
448 flush_vsx_to_thread(target);
449 return target->thread.used_vsr ? regset->n : 0;
453 * tm_cvsx_get - get CVSX registers
454 * @target: The target task.
455 * @regset: The user regset structure.
456 * @to: Destination of copy.
458 * This function gets in transaction checkpointed VSX registers.
460 * When the transaction is active 'ckfp_state' holds the checkpointed
461 * values for the current transaction to fall back on if it aborts
462 * in between. This function gets those checkpointed VSX registers.
463 * The userspace interface buffer layout is as follows.
465 * struct data {
466 * u64 vsx[32];
469 int tm_cvsx_get(struct task_struct *target, const struct user_regset *regset,
470 struct membuf to)
472 u64 buf[32];
473 int i;
475 if (!cpu_has_feature(CPU_FTR_TM))
476 return -ENODEV;
478 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
479 return -ENODATA;
481 /* Flush the state */
482 flush_tmregs_to_thread(target);
483 flush_fp_to_thread(target);
484 flush_altivec_to_thread(target);
485 flush_vsx_to_thread(target);
487 for (i = 0; i < 32 ; i++)
488 buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET];
489 return membuf_write(&to, buf, 32 * sizeof(double));
493 * tm_cvsx_set - set CFPR registers
494 * @target: The target task.
495 * @regset: The user regset structure.
496 * @pos: The buffer position.
497 * @count: Number of bytes to copy.
498 * @kbuf: Kernel buffer to copy into.
499 * @ubuf: User buffer to copy from.
501 * This function sets in transaction checkpointed VSX registers.
503 * When the transaction is active 'ckfp_state' holds the checkpointed
504 * VSX register values for the current transaction to fall back on
505 * if it aborts in between. This function sets these checkpointed
506 * FPR registers. The userspace interface buffer layout is as follows.
508 * struct data {
509 * u64 vsx[32];
512 int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset,
513 unsigned int pos, unsigned int count,
514 const void *kbuf, const void __user *ubuf)
516 u64 buf[32];
517 int ret, i;
519 if (!cpu_has_feature(CPU_FTR_TM))
520 return -ENODEV;
522 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
523 return -ENODATA;
525 /* Flush the state */
526 flush_tmregs_to_thread(target);
527 flush_fp_to_thread(target);
528 flush_altivec_to_thread(target);
529 flush_vsx_to_thread(target);
531 for (i = 0; i < 32 ; i++)
532 buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET];
534 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
535 buf, 0, 32 * sizeof(double));
536 if (!ret)
537 for (i = 0; i < 32 ; i++)
538 target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
540 return ret;
544 * tm_spr_active - get active number of registers in TM SPR
545 * @target: The target task.
546 * @regset: The user regset structure.
548 * This function checks the active number of available
549 * regisers in the transactional memory SPR category.
551 int tm_spr_active(struct task_struct *target, const struct user_regset *regset)
553 if (!cpu_has_feature(CPU_FTR_TM))
554 return -ENODEV;
556 return regset->n;
560 * tm_spr_get - get the TM related SPR registers
561 * @target: The target task.
562 * @regset: The user regset structure.
563 * @to: Destination of copy.
565 * This function gets transactional memory related SPR registers.
566 * The userspace interface buffer layout is as follows.
568 * struct {
569 * u64 tm_tfhar;
570 * u64 tm_texasr;
571 * u64 tm_tfiar;
572 * };
574 int tm_spr_get(struct task_struct *target, const struct user_regset *regset,
575 struct membuf to)
577 /* Build tests */
578 BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr));
579 BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar));
580 BUILD_BUG_ON(TSO(tm_tfiar) + sizeof(u64) != TSO(ckpt_regs));
582 if (!cpu_has_feature(CPU_FTR_TM))
583 return -ENODEV;
585 /* Flush the states */
586 flush_tmregs_to_thread(target);
587 flush_fp_to_thread(target);
588 flush_altivec_to_thread(target);
590 /* TFHAR register */
591 membuf_write(&to, &target->thread.tm_tfhar, sizeof(u64));
592 /* TEXASR register */
593 membuf_write(&to, &target->thread.tm_texasr, sizeof(u64));
594 /* TFIAR register */
595 return membuf_write(&to, &target->thread.tm_tfiar, sizeof(u64));
599 * tm_spr_set - set the TM related SPR registers
600 * @target: The target task.
601 * @regset: The user regset structure.
602 * @pos: The buffer position.
603 * @count: Number of bytes to copy.
604 * @kbuf: Kernel buffer to copy into.
605 * @ubuf: User buffer to copy from.
607 * This function sets transactional memory related SPR registers.
608 * The userspace interface buffer layout is as follows.
610 * struct {
611 * u64 tm_tfhar;
612 * u64 tm_texasr;
613 * u64 tm_tfiar;
614 * };
616 int tm_spr_set(struct task_struct *target, const struct user_regset *regset,
617 unsigned int pos, unsigned int count,
618 const void *kbuf, const void __user *ubuf)
620 int ret;
622 /* Build tests */
623 BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr));
624 BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar));
625 BUILD_BUG_ON(TSO(tm_tfiar) + sizeof(u64) != TSO(ckpt_regs));
627 if (!cpu_has_feature(CPU_FTR_TM))
628 return -ENODEV;
630 /* Flush the states */
631 flush_tmregs_to_thread(target);
632 flush_fp_to_thread(target);
633 flush_altivec_to_thread(target);
635 /* TFHAR register */
636 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
637 &target->thread.tm_tfhar, 0, sizeof(u64));
639 /* TEXASR register */
640 if (!ret)
641 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
642 &target->thread.tm_texasr, sizeof(u64),
643 2 * sizeof(u64));
645 /* TFIAR register */
646 if (!ret)
647 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
648 &target->thread.tm_tfiar,
649 2 * sizeof(u64), 3 * sizeof(u64));
650 return ret;
653 int tm_tar_active(struct task_struct *target, const struct user_regset *regset)
655 if (!cpu_has_feature(CPU_FTR_TM))
656 return -ENODEV;
658 if (MSR_TM_ACTIVE(target->thread.regs->msr))
659 return regset->n;
661 return 0;
664 int tm_tar_get(struct task_struct *target, const struct user_regset *regset,
665 struct membuf to)
667 if (!cpu_has_feature(CPU_FTR_TM))
668 return -ENODEV;
670 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
671 return -ENODATA;
673 return membuf_write(&to, &target->thread.tm_tar, sizeof(u64));
676 int tm_tar_set(struct task_struct *target, const struct user_regset *regset,
677 unsigned int pos, unsigned int count,
678 const void *kbuf, const void __user *ubuf)
680 int ret;
682 if (!cpu_has_feature(CPU_FTR_TM))
683 return -ENODEV;
685 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
686 return -ENODATA;
688 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
689 &target->thread.tm_tar, 0, sizeof(u64));
690 return ret;
693 int tm_ppr_active(struct task_struct *target, const struct user_regset *regset)
695 if (!cpu_has_feature(CPU_FTR_TM))
696 return -ENODEV;
698 if (MSR_TM_ACTIVE(target->thread.regs->msr))
699 return regset->n;
701 return 0;
705 int tm_ppr_get(struct task_struct *target, const struct user_regset *regset,
706 struct membuf to)
708 if (!cpu_has_feature(CPU_FTR_TM))
709 return -ENODEV;
711 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
712 return -ENODATA;
714 return membuf_write(&to, &target->thread.tm_ppr, sizeof(u64));
717 int tm_ppr_set(struct task_struct *target, const struct user_regset *regset,
718 unsigned int pos, unsigned int count,
719 const void *kbuf, const void __user *ubuf)
721 int ret;
723 if (!cpu_has_feature(CPU_FTR_TM))
724 return -ENODEV;
726 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
727 return -ENODATA;
729 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
730 &target->thread.tm_ppr, 0, sizeof(u64));
731 return ret;
734 int tm_dscr_active(struct task_struct *target, const struct user_regset *regset)
736 if (!cpu_has_feature(CPU_FTR_TM))
737 return -ENODEV;
739 if (MSR_TM_ACTIVE(target->thread.regs->msr))
740 return regset->n;
742 return 0;
745 int tm_dscr_get(struct task_struct *target, const struct user_regset *regset,
746 struct membuf to)
748 if (!cpu_has_feature(CPU_FTR_TM))
749 return -ENODEV;
751 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
752 return -ENODATA;
754 return membuf_write(&to, &target->thread.tm_dscr, sizeof(u64));
757 int tm_dscr_set(struct task_struct *target, const struct user_regset *regset,
758 unsigned int pos, unsigned int count,
759 const void *kbuf, const void __user *ubuf)
761 int ret;
763 if (!cpu_has_feature(CPU_FTR_TM))
764 return -ENODEV;
766 if (!MSR_TM_ACTIVE(target->thread.regs->msr))
767 return -ENODATA;
769 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
770 &target->thread.tm_dscr, 0, sizeof(u64));
771 return ret;
774 int tm_cgpr32_get(struct task_struct *target, const struct user_regset *regset,
775 struct membuf to)
777 gpr32_get_common(target, regset, to,
778 &target->thread.ckpt_regs.gpr[0]);
779 return membuf_zero(&to, ELF_NGREG * sizeof(u32));
782 int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset,
783 unsigned int pos, unsigned int count,
784 const void *kbuf, const void __user *ubuf)
786 return gpr32_set_common(target, regset, pos, count, kbuf, ubuf,
787 &target->thread.ckpt_regs.gpr[0]);