1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include <linux/regset.h>
5 #include <linux/nospec.h>
6 #include <linux/pkeys.h>
8 #include "ptrace-decl.h"
10 struct pt_regs_offset {
15 #define STR(s) #s /* convert to string */
16 #define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)}
17 #define GPR_OFFSET_NAME(num) \
18 {.name = STR(r##num), .offset = offsetof(struct pt_regs, gpr[num])}, \
19 {.name = STR(gpr##num), .offset = offsetof(struct pt_regs, gpr[num])}
20 #define REG_OFFSET_END {.name = NULL, .offset = 0}
22 static const struct pt_regs_offset regoffset_table[] = {
58 REG_OFFSET_NAME(link),
62 REG_OFFSET_NAME(softe),
66 REG_OFFSET_NAME(trap),
68 REG_OFFSET_NAME(dsisr),
73 * regs_query_register_offset() - query register offset from its name
74 * @name: the name of a register
76 * regs_query_register_offset() returns the offset of a register in struct
77 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
79 int regs_query_register_offset(const char *name)
81 const struct pt_regs_offset *roff;
82 for (roff = regoffset_table; roff->name != NULL; roff++)
83 if (!strcmp(roff->name, name))
89 * regs_query_register_name() - query register name from its offset
90 * @offset: the offset of a register in struct pt_regs.
92 * regs_query_register_name() returns the name of a register from its
93 * offset in struct pt_regs. If the @offset is invalid, this returns NULL;
95 const char *regs_query_register_name(unsigned int offset)
97 const struct pt_regs_offset *roff;
98 for (roff = regoffset_table; roff->name != NULL; roff++)
99 if (roff->offset == offset)
105 * does not yet catch signals sent when the child dies.
106 * in exit.c or in signal.c.
109 static unsigned long get_user_msr(struct task_struct *task)
111 return task->thread.regs->msr | task->thread.fpexc_mode;
114 static __always_inline int set_user_msr(struct task_struct *task, unsigned long msr)
116 unsigned long newmsr = (task->thread.regs->msr & ~MSR_DEBUGCHANGE) |
117 (msr & MSR_DEBUGCHANGE);
118 regs_set_return_msr(task->thread.regs, newmsr);
123 static int get_user_dscr(struct task_struct *task, unsigned long *data)
125 *data = task->thread.dscr;
129 static int set_user_dscr(struct task_struct *task, unsigned long dscr)
131 task->thread.dscr = dscr;
132 task->thread.dscr_inherit = 1;
136 static int get_user_dscr(struct task_struct *task, unsigned long *data)
141 static int set_user_dscr(struct task_struct *task, unsigned long dscr)
148 * We prevent mucking around with the reserved area of trap
149 * which are used internally by the kernel.
151 static __always_inline int set_user_trap(struct task_struct *task, unsigned long trap)
153 set_trap(task->thread.regs, trap);
158 * Get contents of register REGNO in task TASK.
160 int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data)
162 unsigned int regs_max;
164 if (task->thread.regs == NULL || !data)
167 if (regno == PT_MSR) {
168 *data = get_user_msr(task);
172 if (regno == PT_DSCR)
173 return get_user_dscr(task, data);
176 * softe copies paca->irq_soft_mask variable state. Since irq_soft_mask is
177 * no more used as a flag, lets force usr to alway see the softe value as 1
178 * which means interrupts are not soft disabled.
180 if (IS_ENABLED(CONFIG_PPC64) && regno == PT_SOFTE) {
185 regs_max = sizeof(struct user_pt_regs) / sizeof(unsigned long);
186 if (regno < regs_max) {
187 regno = array_index_nospec(regno, regs_max);
188 *data = ((unsigned long *)task->thread.regs)[regno];
196 * Write contents of register REGNO in task TASK.
198 int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)
200 if (task->thread.regs == NULL)
204 return set_user_msr(task, data);
205 if (regno == PT_TRAP)
206 return set_user_trap(task, data);
207 if (regno == PT_DSCR)
208 return set_user_dscr(task, data);
210 if (regno <= PT_MAX_PUT_REG) {
211 regno = array_index_nospec(regno, PT_MAX_PUT_REG + 1);
212 ((unsigned long *)task->thread.regs)[regno] = data;
218 static int gpr_get(struct task_struct *target, const struct user_regset *regset,
221 struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr));
223 struct membuf to_softe = membuf_at(&to, offsetof(struct pt_regs, softe));
225 if (target->thread.regs == NULL)
228 membuf_write(&to, target->thread.regs, sizeof(struct user_pt_regs));
230 membuf_store(&to_msr, get_user_msr(target));
232 membuf_store(&to_softe, 0x1ul);
234 return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
235 sizeof(struct user_pt_regs));
238 static int gpr_set(struct task_struct *target, const struct user_regset *regset,
239 unsigned int pos, unsigned int count, const void *kbuf,
240 const void __user *ubuf)
245 if (target->thread.regs == NULL)
248 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
250 0, PT_MSR * sizeof(reg));
252 if (!ret && count > 0) {
253 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®,
254 PT_MSR * sizeof(reg),
255 (PT_MSR + 1) * sizeof(reg));
257 ret = set_user_msr(target, reg);
260 BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
261 offsetof(struct pt_regs, msr) + sizeof(long));
264 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
265 &target->thread.regs->orig_gpr3,
266 PT_ORIG_R3 * sizeof(reg),
267 (PT_MAX_PUT_REG + 1) * sizeof(reg));
269 if (PT_MAX_PUT_REG + 1 < PT_TRAP && !ret)
270 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
271 (PT_MAX_PUT_REG + 1) * sizeof(reg),
272 PT_TRAP * sizeof(reg));
274 if (!ret && count > 0) {
275 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®,
276 PT_TRAP * sizeof(reg),
277 (PT_TRAP + 1) * sizeof(reg));
279 ret = set_user_trap(target, reg);
283 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
284 (PT_TRAP + 1) * sizeof(reg), -1);
290 static int ppr_get(struct task_struct *target, const struct user_regset *regset,
293 return membuf_write(&to, &target->thread.regs->ppr, sizeof(u64));
296 static int ppr_set(struct task_struct *target, const struct user_regset *regset,
297 unsigned int pos, unsigned int count, const void *kbuf,
298 const void __user *ubuf)
300 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
301 &target->thread.regs->ppr, 0, sizeof(u64));
304 static int dscr_get(struct task_struct *target, const struct user_regset *regset,
307 return membuf_write(&to, &target->thread.dscr, sizeof(u64));
309 static int dscr_set(struct task_struct *target, const struct user_regset *regset,
310 unsigned int pos, unsigned int count, const void *kbuf,
311 const void __user *ubuf)
313 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
314 &target->thread.dscr, 0, sizeof(u64));
317 #ifdef CONFIG_PPC_BOOK3S_64
318 static int tar_get(struct task_struct *target, const struct user_regset *regset,
321 return membuf_write(&to, &target->thread.tar, sizeof(u64));
323 static int tar_set(struct task_struct *target, const struct user_regset *regset,
324 unsigned int pos, unsigned int count, const void *kbuf,
325 const void __user *ubuf)
327 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
328 &target->thread.tar, 0, sizeof(u64));
331 static int ebb_active(struct task_struct *target, const struct user_regset *regset)
333 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
336 if (target->thread.used_ebb)
342 static int ebb_get(struct task_struct *target, const struct user_regset *regset,
346 BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr));
347 BUILD_BUG_ON(TSO(ebbhr) + sizeof(unsigned long) != TSO(bescr));
349 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
352 if (!target->thread.used_ebb)
355 return membuf_write(&to, &target->thread.ebbrr, 3 * sizeof(unsigned long));
358 static int ebb_set(struct task_struct *target, const struct user_regset *regset,
359 unsigned int pos, unsigned int count, const void *kbuf,
360 const void __user *ubuf)
365 BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr));
366 BUILD_BUG_ON(TSO(ebbhr) + sizeof(unsigned long) != TSO(bescr));
368 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
371 if (target->thread.used_ebb)
374 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ebbrr,
375 0, sizeof(unsigned long));
378 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
379 &target->thread.ebbhr, sizeof(unsigned long),
380 2 * sizeof(unsigned long));
383 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
384 &target->thread.bescr, 2 * sizeof(unsigned long),
385 3 * sizeof(unsigned long));
389 static int pmu_active(struct task_struct *target, const struct user_regset *regset)
391 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
397 static int pmu_get(struct task_struct *target, const struct user_regset *regset,
401 BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
402 BUILD_BUG_ON(TSO(sdar) + sizeof(unsigned long) != TSO(sier));
403 BUILD_BUG_ON(TSO(sier) + sizeof(unsigned long) != TSO(mmcr2));
404 BUILD_BUG_ON(TSO(mmcr2) + sizeof(unsigned long) != TSO(mmcr0));
406 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
409 return membuf_write(&to, &target->thread.siar, 5 * sizeof(unsigned long));
412 static int pmu_set(struct task_struct *target, const struct user_regset *regset,
413 unsigned int pos, unsigned int count, const void *kbuf,
414 const void __user *ubuf)
419 BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
420 BUILD_BUG_ON(TSO(sdar) + sizeof(unsigned long) != TSO(sier));
421 BUILD_BUG_ON(TSO(sier) + sizeof(unsigned long) != TSO(mmcr2));
422 BUILD_BUG_ON(TSO(mmcr2) + sizeof(unsigned long) != TSO(mmcr0));
424 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
427 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.siar,
428 0, sizeof(unsigned long));
431 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
432 &target->thread.sdar, sizeof(unsigned long),
433 2 * sizeof(unsigned long));
436 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
437 &target->thread.sier, 2 * sizeof(unsigned long),
438 3 * sizeof(unsigned long));
441 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
442 &target->thread.mmcr2, 3 * sizeof(unsigned long),
443 4 * sizeof(unsigned long));
446 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
447 &target->thread.mmcr0, 4 * sizeof(unsigned long),
448 5 * sizeof(unsigned long));
453 #ifdef CONFIG_PPC_MEM_KEYS
454 static int pkey_active(struct task_struct *target, const struct user_regset *regset)
456 if (!arch_pkeys_enabled())
462 static int pkey_get(struct task_struct *target, const struct user_regset *regset,
466 if (!arch_pkeys_enabled())
469 membuf_store(&to, target->thread.regs->amr);
470 membuf_store(&to, target->thread.regs->iamr);
471 return membuf_store(&to, default_uamor);
474 static int pkey_set(struct task_struct *target, const struct user_regset *regset,
475 unsigned int pos, unsigned int count, const void *kbuf,
476 const void __user *ubuf)
481 if (!arch_pkeys_enabled())
484 /* Only the AMR can be set from userspace */
485 if (pos != 0 || count != sizeof(new_amr))
488 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
489 &new_amr, 0, sizeof(new_amr));
494 * UAMOR determines which bits of the AMR can be set from userspace.
495 * UAMOR value 0b11 indicates that the AMR value can be modified
496 * from userspace. If the kernel is using a specific key, we avoid
497 * userspace modifying the AMR value for that key by masking them
500 * Pick the AMR values for the keys that kernel is using. This
501 * will be indicated by the ~default_uamor bits.
503 target->thread.regs->amr = (new_amr & default_uamor) |
504 (target->thread.regs->amr & ~default_uamor);
508 #endif /* CONFIG_PPC_MEM_KEYS */
510 static const struct user_regset native_regsets[] = {
512 .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
513 .size = sizeof(long), .align = sizeof(long),
514 .regset_get = gpr_get, .set = gpr_set
517 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
518 .size = sizeof(double), .align = sizeof(double),
519 .regset_get = fpr_get, .set = fpr_set
521 #ifdef CONFIG_ALTIVEC
523 .core_note_type = NT_PPC_VMX, .n = 34,
524 .size = sizeof(vector128), .align = sizeof(vector128),
525 .active = vr_active, .regset_get = vr_get, .set = vr_set
530 .core_note_type = NT_PPC_VSX, .n = 32,
531 .size = sizeof(double), .align = sizeof(double),
532 .active = vsr_active, .regset_get = vsr_get, .set = vsr_set
537 .core_note_type = NT_PPC_SPE, .n = 35,
538 .size = sizeof(u32), .align = sizeof(u32),
539 .active = evr_active, .regset_get = evr_get, .set = evr_set
542 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
544 .core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
545 .size = sizeof(long), .align = sizeof(long),
546 .active = tm_cgpr_active, .regset_get = tm_cgpr_get, .set = tm_cgpr_set
549 .core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
550 .size = sizeof(double), .align = sizeof(double),
551 .active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
554 .core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
555 .size = sizeof(vector128), .align = sizeof(vector128),
556 .active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
559 .core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
560 .size = sizeof(double), .align = sizeof(double),
561 .active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
564 .core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
565 .size = sizeof(u64), .align = sizeof(u64),
566 .active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
569 .core_note_type = NT_PPC_TM_CTAR, .n = 1,
570 .size = sizeof(u64), .align = sizeof(u64),
571 .active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
574 .core_note_type = NT_PPC_TM_CPPR, .n = 1,
575 .size = sizeof(u64), .align = sizeof(u64),
576 .active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
578 [REGSET_TM_CDSCR] = {
579 .core_note_type = NT_PPC_TM_CDSCR, .n = 1,
580 .size = sizeof(u64), .align = sizeof(u64),
581 .active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
586 .core_note_type = NT_PPC_PPR, .n = 1,
587 .size = sizeof(u64), .align = sizeof(u64),
588 .regset_get = ppr_get, .set = ppr_set
591 .core_note_type = NT_PPC_DSCR, .n = 1,
592 .size = sizeof(u64), .align = sizeof(u64),
593 .regset_get = dscr_get, .set = dscr_set
596 #ifdef CONFIG_PPC_BOOK3S_64
598 .core_note_type = NT_PPC_TAR, .n = 1,
599 .size = sizeof(u64), .align = sizeof(u64),
600 .regset_get = tar_get, .set = tar_set
603 .core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
604 .size = sizeof(u64), .align = sizeof(u64),
605 .active = ebb_active, .regset_get = ebb_get, .set = ebb_set
608 .core_note_type = NT_PPC_PMU, .n = ELF_NPMU,
609 .size = sizeof(u64), .align = sizeof(u64),
610 .active = pmu_active, .regset_get = pmu_get, .set = pmu_set
613 #ifdef CONFIG_PPC_MEM_KEYS
615 .core_note_type = NT_PPC_PKEY, .n = ELF_NPKEY,
616 .size = sizeof(u64), .align = sizeof(u64),
617 .active = pkey_active, .regset_get = pkey_get, .set = pkey_set
622 const struct user_regset_view user_ppc_native_view = {
623 .name = UTS_MACHINE, .e_machine = ELF_ARCH, .ei_osabi = ELF_OSABI,
624 .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
627 #include <linux/compat.h>
629 int gpr32_get_common(struct task_struct *target,
630 const struct user_regset *regset,
631 struct membuf to, unsigned long *regs)
635 for (i = 0; i < PT_MSR; i++)
636 membuf_store(&to, (u32)regs[i]);
637 membuf_store(&to, (u32)get_user_msr(target));
638 for (i++ ; i < PT_REGS_COUNT; i++)
639 membuf_store(&to, (u32)regs[i]);
640 return membuf_zero(&to, (ELF_NGREG - PT_REGS_COUNT) * sizeof(u32));
643 int gpr32_set_common(struct task_struct *target,
644 const struct user_regset *regset,
645 unsigned int pos, unsigned int count,
646 const void *kbuf, const void __user *ubuf,
649 const compat_ulong_t *k = kbuf;
650 const compat_ulong_t __user *u = ubuf;
653 if (!kbuf && !user_read_access_begin(u, count))
657 count /= sizeof(reg);
660 for (; count > 0 && pos < PT_MSR; --count)
663 for (; count > 0 && pos < PT_MSR; --count) {
664 unsafe_get_user(reg, u++, Efault);
669 if (count > 0 && pos == PT_MSR) {
673 unsafe_get_user(reg, u++, Efault);
674 set_user_msr(target, reg);
680 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count)
682 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
685 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) {
686 unsafe_get_user(reg, u++, Efault);
689 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
690 unsafe_get_user(reg, u++, Efault);
693 if (count > 0 && pos == PT_TRAP) {
697 unsafe_get_user(reg, u++, Efault);
698 set_user_trap(target, reg);
703 user_read_access_end();
708 count *= sizeof(reg);
709 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
710 (PT_TRAP + 1) * sizeof(reg), -1);
713 user_read_access_end();
717 static int gpr32_get(struct task_struct *target,
718 const struct user_regset *regset,
721 if (target->thread.regs == NULL)
724 return gpr32_get_common(target, regset, to,
725 &target->thread.regs->gpr[0]);
728 static int gpr32_set(struct task_struct *target,
729 const struct user_regset *regset,
730 unsigned int pos, unsigned int count,
731 const void *kbuf, const void __user *ubuf)
733 if (target->thread.regs == NULL)
736 return gpr32_set_common(target, regset, pos, count, kbuf, ubuf,
737 &target->thread.regs->gpr[0]);
741 * These are the regset flavors matching the CONFIG_PPC32 native set.
743 static const struct user_regset compat_regsets[] = {
745 .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
746 .size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
747 .regset_get = gpr32_get, .set = gpr32_set
750 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
751 .size = sizeof(double), .align = sizeof(double),
752 .regset_get = fpr_get, .set = fpr_set
754 #ifdef CONFIG_ALTIVEC
756 .core_note_type = NT_PPC_VMX, .n = 34,
757 .size = sizeof(vector128), .align = sizeof(vector128),
758 .active = vr_active, .regset_get = vr_get, .set = vr_set
763 .core_note_type = NT_PPC_SPE, .n = 35,
764 .size = sizeof(u32), .align = sizeof(u32),
765 .active = evr_active, .regset_get = evr_get, .set = evr_set
768 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
770 .core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
771 .size = sizeof(long), .align = sizeof(long),
772 .active = tm_cgpr_active,
773 .regset_get = tm_cgpr32_get, .set = tm_cgpr32_set
776 .core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
777 .size = sizeof(double), .align = sizeof(double),
778 .active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
781 .core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
782 .size = sizeof(vector128), .align = sizeof(vector128),
783 .active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
786 .core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
787 .size = sizeof(double), .align = sizeof(double),
788 .active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
791 .core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
792 .size = sizeof(u64), .align = sizeof(u64),
793 .active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
796 .core_note_type = NT_PPC_TM_CTAR, .n = 1,
797 .size = sizeof(u64), .align = sizeof(u64),
798 .active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
801 .core_note_type = NT_PPC_TM_CPPR, .n = 1,
802 .size = sizeof(u64), .align = sizeof(u64),
803 .active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
805 [REGSET_TM_CDSCR] = {
806 .core_note_type = NT_PPC_TM_CDSCR, .n = 1,
807 .size = sizeof(u64), .align = sizeof(u64),
808 .active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
813 .core_note_type = NT_PPC_PPR, .n = 1,
814 .size = sizeof(u64), .align = sizeof(u64),
815 .regset_get = ppr_get, .set = ppr_set
818 .core_note_type = NT_PPC_DSCR, .n = 1,
819 .size = sizeof(u64), .align = sizeof(u64),
820 .regset_get = dscr_get, .set = dscr_set
823 #ifdef CONFIG_PPC_BOOK3S_64
825 .core_note_type = NT_PPC_TAR, .n = 1,
826 .size = sizeof(u64), .align = sizeof(u64),
827 .regset_get = tar_get, .set = tar_set
830 .core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
831 .size = sizeof(u64), .align = sizeof(u64),
832 .active = ebb_active, .regset_get = ebb_get, .set = ebb_set
837 static const struct user_regset_view user_ppc_compat_view = {
838 .name = "ppc", .e_machine = EM_PPC, .ei_osabi = ELF_OSABI,
839 .regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets)
842 const struct user_regset_view *task_user_regset_view(struct task_struct *task)
844 if (IS_ENABLED(CONFIG_PPC64) && test_tsk_thread_flag(task, TIF_32BIT))
845 return &user_ppc_compat_view;
846 return &user_ppc_native_view;