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 task->thread.regs->msr &= ~MSR_DEBUGCHANGE;
117 task->thread.regs->msr |= msr & MSR_DEBUGCHANGE;
122 static int get_user_dscr(struct task_struct *task, unsigned long *data)
124 *data = task->thread.dscr;
128 static int set_user_dscr(struct task_struct *task, unsigned long dscr)
130 task->thread.dscr = dscr;
131 task->thread.dscr_inherit = 1;
135 static int get_user_dscr(struct task_struct *task, unsigned long *data)
140 static int set_user_dscr(struct task_struct *task, unsigned long dscr)
147 * We prevent mucking around with the reserved area of trap
148 * which are used internally by the kernel.
150 static __always_inline int set_user_trap(struct task_struct *task, unsigned long trap)
152 set_trap(task->thread.regs, trap);
157 * Get contents of register REGNO in task TASK.
159 int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data)
161 unsigned int regs_max;
163 if (task->thread.regs == NULL || !data)
166 if (regno == PT_MSR) {
167 *data = get_user_msr(task);
171 if (regno == PT_DSCR)
172 return get_user_dscr(task, data);
175 * softe copies paca->irq_soft_mask variable state. Since irq_soft_mask is
176 * no more used as a flag, lets force usr to alway see the softe value as 1
177 * which means interrupts are not soft disabled.
179 if (IS_ENABLED(CONFIG_PPC64) && regno == PT_SOFTE) {
184 regs_max = sizeof(struct user_pt_regs) / sizeof(unsigned long);
185 if (regno < regs_max) {
186 regno = array_index_nospec(regno, regs_max);
187 *data = ((unsigned long *)task->thread.regs)[regno];
195 * Write contents of register REGNO in task TASK.
197 int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)
199 if (task->thread.regs == NULL)
203 return set_user_msr(task, data);
204 if (regno == PT_TRAP)
205 return set_user_trap(task, data);
206 if (regno == PT_DSCR)
207 return set_user_dscr(task, data);
209 if (regno <= PT_MAX_PUT_REG) {
210 regno = array_index_nospec(regno, PT_MAX_PUT_REG + 1);
211 ((unsigned long *)task->thread.regs)[regno] = data;
217 static int gpr_get(struct task_struct *target, const struct user_regset *regset,
220 struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr));
222 struct membuf to_softe = membuf_at(&to, offsetof(struct pt_regs, softe));
224 if (target->thread.regs == NULL)
227 membuf_write(&to, target->thread.regs, sizeof(struct user_pt_regs));
229 membuf_store(&to_msr, get_user_msr(target));
231 membuf_store(&to_softe, 0x1ul);
233 return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
234 sizeof(struct user_pt_regs));
237 static int gpr_set(struct task_struct *target, const struct user_regset *regset,
238 unsigned int pos, unsigned int count, const void *kbuf,
239 const void __user *ubuf)
244 if (target->thread.regs == NULL)
247 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
249 0, PT_MSR * sizeof(reg));
251 if (!ret && count > 0) {
252 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®,
253 PT_MSR * sizeof(reg),
254 (PT_MSR + 1) * sizeof(reg));
256 ret = set_user_msr(target, reg);
259 BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
260 offsetof(struct pt_regs, msr) + sizeof(long));
263 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
264 &target->thread.regs->orig_gpr3,
265 PT_ORIG_R3 * sizeof(reg),
266 (PT_MAX_PUT_REG + 1) * sizeof(reg));
268 if (PT_MAX_PUT_REG + 1 < PT_TRAP && !ret)
269 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
270 (PT_MAX_PUT_REG + 1) * sizeof(reg),
271 PT_TRAP * sizeof(reg));
273 if (!ret && count > 0) {
274 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®,
275 PT_TRAP * sizeof(reg),
276 (PT_TRAP + 1) * sizeof(reg));
278 ret = set_user_trap(target, reg);
282 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
283 (PT_TRAP + 1) * sizeof(reg), -1);
289 static int ppr_get(struct task_struct *target, const struct user_regset *regset,
292 return membuf_write(&to, &target->thread.regs->ppr, sizeof(u64));
295 static int ppr_set(struct task_struct *target, const struct user_regset *regset,
296 unsigned int pos, unsigned int count, const void *kbuf,
297 const void __user *ubuf)
299 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
300 &target->thread.regs->ppr, 0, sizeof(u64));
303 static int dscr_get(struct task_struct *target, const struct user_regset *regset,
306 return membuf_write(&to, &target->thread.dscr, sizeof(u64));
308 static int dscr_set(struct task_struct *target, const struct user_regset *regset,
309 unsigned int pos, unsigned int count, const void *kbuf,
310 const void __user *ubuf)
312 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
313 &target->thread.dscr, 0, sizeof(u64));
316 #ifdef CONFIG_PPC_BOOK3S_64
317 static int tar_get(struct task_struct *target, const struct user_regset *regset,
320 return membuf_write(&to, &target->thread.tar, sizeof(u64));
322 static int tar_set(struct task_struct *target, const struct user_regset *regset,
323 unsigned int pos, unsigned int count, const void *kbuf,
324 const void __user *ubuf)
326 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
327 &target->thread.tar, 0, sizeof(u64));
330 static int ebb_active(struct task_struct *target, const struct user_regset *regset)
332 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
335 if (target->thread.used_ebb)
341 static int ebb_get(struct task_struct *target, const struct user_regset *regset,
345 BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr));
346 BUILD_BUG_ON(TSO(ebbhr) + sizeof(unsigned long) != TSO(bescr));
348 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
351 if (!target->thread.used_ebb)
354 return membuf_write(&to, &target->thread.ebbrr, 3 * sizeof(unsigned long));
357 static int ebb_set(struct task_struct *target, const struct user_regset *regset,
358 unsigned int pos, unsigned int count, const void *kbuf,
359 const void __user *ubuf)
364 BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr));
365 BUILD_BUG_ON(TSO(ebbhr) + sizeof(unsigned long) != TSO(bescr));
367 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
370 if (target->thread.used_ebb)
373 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ebbrr,
374 0, sizeof(unsigned long));
377 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
378 &target->thread.ebbhr, sizeof(unsigned long),
379 2 * sizeof(unsigned long));
382 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
383 &target->thread.bescr, 2 * sizeof(unsigned long),
384 3 * sizeof(unsigned long));
388 static int pmu_active(struct task_struct *target, const struct user_regset *regset)
390 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
396 static int pmu_get(struct task_struct *target, const struct user_regset *regset,
400 BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
401 BUILD_BUG_ON(TSO(sdar) + sizeof(unsigned long) != TSO(sier));
402 BUILD_BUG_ON(TSO(sier) + sizeof(unsigned long) != TSO(mmcr2));
403 BUILD_BUG_ON(TSO(mmcr2) + sizeof(unsigned long) != TSO(mmcr0));
405 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
408 return membuf_write(&to, &target->thread.siar, 5 * sizeof(unsigned long));
411 static int pmu_set(struct task_struct *target, const struct user_regset *regset,
412 unsigned int pos, unsigned int count, const void *kbuf,
413 const void __user *ubuf)
418 BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
419 BUILD_BUG_ON(TSO(sdar) + sizeof(unsigned long) != TSO(sier));
420 BUILD_BUG_ON(TSO(sier) + sizeof(unsigned long) != TSO(mmcr2));
421 BUILD_BUG_ON(TSO(mmcr2) + sizeof(unsigned long) != TSO(mmcr0));
423 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
426 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.siar,
427 0, sizeof(unsigned long));
430 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
431 &target->thread.sdar, sizeof(unsigned long),
432 2 * sizeof(unsigned long));
435 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
436 &target->thread.sier, 2 * sizeof(unsigned long),
437 3 * sizeof(unsigned long));
440 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
441 &target->thread.mmcr2, 3 * sizeof(unsigned long),
442 4 * sizeof(unsigned long));
445 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
446 &target->thread.mmcr0, 4 * sizeof(unsigned long),
447 5 * sizeof(unsigned long));
452 #ifdef CONFIG_PPC_MEM_KEYS
453 static int pkey_active(struct task_struct *target, const struct user_regset *regset)
455 if (!arch_pkeys_enabled())
461 static int pkey_get(struct task_struct *target, const struct user_regset *regset,
465 if (!arch_pkeys_enabled())
468 membuf_store(&to, target->thread.regs->amr);
469 membuf_store(&to, target->thread.regs->iamr);
470 return membuf_store(&to, default_uamor);
473 static int pkey_set(struct task_struct *target, const struct user_regset *regset,
474 unsigned int pos, unsigned int count, const void *kbuf,
475 const void __user *ubuf)
480 if (!arch_pkeys_enabled())
483 /* Only the AMR can be set from userspace */
484 if (pos != 0 || count != sizeof(new_amr))
487 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
488 &new_amr, 0, sizeof(new_amr));
493 * UAMOR determines which bits of the AMR can be set from userspace.
494 * UAMOR value 0b11 indicates that the AMR value can be modified
495 * from userspace. If the kernel is using a specific key, we avoid
496 * userspace modifying the AMR value for that key by masking them
499 * Pick the AMR values for the keys that kernel is using. This
500 * will be indicated by the ~default_uamor bits.
502 target->thread.regs->amr = (new_amr & default_uamor) |
503 (target->thread.regs->amr & ~default_uamor);
507 #endif /* CONFIG_PPC_MEM_KEYS */
509 static const struct user_regset native_regsets[] = {
511 .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
512 .size = sizeof(long), .align = sizeof(long),
513 .regset_get = gpr_get, .set = gpr_set
516 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
517 .size = sizeof(double), .align = sizeof(double),
518 .regset_get = fpr_get, .set = fpr_set
520 #ifdef CONFIG_ALTIVEC
522 .core_note_type = NT_PPC_VMX, .n = 34,
523 .size = sizeof(vector128), .align = sizeof(vector128),
524 .active = vr_active, .regset_get = vr_get, .set = vr_set
529 .core_note_type = NT_PPC_VSX, .n = 32,
530 .size = sizeof(double), .align = sizeof(double),
531 .active = vsr_active, .regset_get = vsr_get, .set = vsr_set
536 .core_note_type = NT_PPC_SPE, .n = 35,
537 .size = sizeof(u32), .align = sizeof(u32),
538 .active = evr_active, .regset_get = evr_get, .set = evr_set
541 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
543 .core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
544 .size = sizeof(long), .align = sizeof(long),
545 .active = tm_cgpr_active, .regset_get = tm_cgpr_get, .set = tm_cgpr_set
548 .core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
549 .size = sizeof(double), .align = sizeof(double),
550 .active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
553 .core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
554 .size = sizeof(vector128), .align = sizeof(vector128),
555 .active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
558 .core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
559 .size = sizeof(double), .align = sizeof(double),
560 .active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
563 .core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
564 .size = sizeof(u64), .align = sizeof(u64),
565 .active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
568 .core_note_type = NT_PPC_TM_CTAR, .n = 1,
569 .size = sizeof(u64), .align = sizeof(u64),
570 .active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
573 .core_note_type = NT_PPC_TM_CPPR, .n = 1,
574 .size = sizeof(u64), .align = sizeof(u64),
575 .active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
577 [REGSET_TM_CDSCR] = {
578 .core_note_type = NT_PPC_TM_CDSCR, .n = 1,
579 .size = sizeof(u64), .align = sizeof(u64),
580 .active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
585 .core_note_type = NT_PPC_PPR, .n = 1,
586 .size = sizeof(u64), .align = sizeof(u64),
587 .regset_get = ppr_get, .set = ppr_set
590 .core_note_type = NT_PPC_DSCR, .n = 1,
591 .size = sizeof(u64), .align = sizeof(u64),
592 .regset_get = dscr_get, .set = dscr_set
595 #ifdef CONFIG_PPC_BOOK3S_64
597 .core_note_type = NT_PPC_TAR, .n = 1,
598 .size = sizeof(u64), .align = sizeof(u64),
599 .regset_get = tar_get, .set = tar_set
602 .core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
603 .size = sizeof(u64), .align = sizeof(u64),
604 .active = ebb_active, .regset_get = ebb_get, .set = ebb_set
607 .core_note_type = NT_PPC_PMU, .n = ELF_NPMU,
608 .size = sizeof(u64), .align = sizeof(u64),
609 .active = pmu_active, .regset_get = pmu_get, .set = pmu_set
612 #ifdef CONFIG_PPC_MEM_KEYS
614 .core_note_type = NT_PPC_PKEY, .n = ELF_NPKEY,
615 .size = sizeof(u64), .align = sizeof(u64),
616 .active = pkey_active, .regset_get = pkey_get, .set = pkey_set
621 const struct user_regset_view user_ppc_native_view = {
622 .name = UTS_MACHINE, .e_machine = ELF_ARCH, .ei_osabi = ELF_OSABI,
623 .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
626 #include <linux/compat.h>
628 int gpr32_get_common(struct task_struct *target,
629 const struct user_regset *regset,
630 struct membuf to, unsigned long *regs)
634 for (i = 0; i < PT_MSR; i++)
635 membuf_store(&to, (u32)regs[i]);
636 membuf_store(&to, (u32)get_user_msr(target));
637 for (i++ ; i < PT_REGS_COUNT; i++)
638 membuf_store(&to, (u32)regs[i]);
639 return membuf_zero(&to, (ELF_NGREG - PT_REGS_COUNT) * sizeof(u32));
642 int gpr32_set_common(struct task_struct *target,
643 const struct user_regset *regset,
644 unsigned int pos, unsigned int count,
645 const void *kbuf, const void __user *ubuf,
648 const compat_ulong_t *k = kbuf;
649 const compat_ulong_t __user *u = ubuf;
652 if (!kbuf && !user_read_access_begin(u, count))
656 count /= sizeof(reg);
659 for (; count > 0 && pos < PT_MSR; --count)
662 for (; count > 0 && pos < PT_MSR; --count) {
663 unsafe_get_user(reg, u++, Efault);
668 if (count > 0 && pos == PT_MSR) {
672 unsafe_get_user(reg, u++, Efault);
673 set_user_msr(target, reg);
679 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count)
681 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
684 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) {
685 unsafe_get_user(reg, u++, Efault);
688 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
689 unsafe_get_user(reg, u++, Efault);
692 if (count > 0 && pos == PT_TRAP) {
696 unsafe_get_user(reg, u++, Efault);
697 set_user_trap(target, reg);
702 user_read_access_end();
707 count *= sizeof(reg);
708 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
709 (PT_TRAP + 1) * sizeof(reg), -1);
712 user_read_access_end();
716 static int gpr32_get(struct task_struct *target,
717 const struct user_regset *regset,
720 if (target->thread.regs == NULL)
723 return gpr32_get_common(target, regset, to,
724 &target->thread.regs->gpr[0]);
727 static int gpr32_set(struct task_struct *target,
728 const struct user_regset *regset,
729 unsigned int pos, unsigned int count,
730 const void *kbuf, const void __user *ubuf)
732 if (target->thread.regs == NULL)
735 return gpr32_set_common(target, regset, pos, count, kbuf, ubuf,
736 &target->thread.regs->gpr[0]);
740 * These are the regset flavors matching the CONFIG_PPC32 native set.
742 static const struct user_regset compat_regsets[] = {
744 .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
745 .size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
746 .regset_get = gpr32_get, .set = gpr32_set
749 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
750 .size = sizeof(double), .align = sizeof(double),
751 .regset_get = fpr_get, .set = fpr_set
753 #ifdef CONFIG_ALTIVEC
755 .core_note_type = NT_PPC_VMX, .n = 34,
756 .size = sizeof(vector128), .align = sizeof(vector128),
757 .active = vr_active, .regset_get = vr_get, .set = vr_set
762 .core_note_type = NT_PPC_SPE, .n = 35,
763 .size = sizeof(u32), .align = sizeof(u32),
764 .active = evr_active, .regset_get = evr_get, .set = evr_set
767 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
769 .core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
770 .size = sizeof(long), .align = sizeof(long),
771 .active = tm_cgpr_active,
772 .regset_get = tm_cgpr32_get, .set = tm_cgpr32_set
775 .core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
776 .size = sizeof(double), .align = sizeof(double),
777 .active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
780 .core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
781 .size = sizeof(vector128), .align = sizeof(vector128),
782 .active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
785 .core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
786 .size = sizeof(double), .align = sizeof(double),
787 .active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
790 .core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
791 .size = sizeof(u64), .align = sizeof(u64),
792 .active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
795 .core_note_type = NT_PPC_TM_CTAR, .n = 1,
796 .size = sizeof(u64), .align = sizeof(u64),
797 .active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
800 .core_note_type = NT_PPC_TM_CPPR, .n = 1,
801 .size = sizeof(u64), .align = sizeof(u64),
802 .active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
804 [REGSET_TM_CDSCR] = {
805 .core_note_type = NT_PPC_TM_CDSCR, .n = 1,
806 .size = sizeof(u64), .align = sizeof(u64),
807 .active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
812 .core_note_type = NT_PPC_PPR, .n = 1,
813 .size = sizeof(u64), .align = sizeof(u64),
814 .regset_get = ppr_get, .set = ppr_set
817 .core_note_type = NT_PPC_DSCR, .n = 1,
818 .size = sizeof(u64), .align = sizeof(u64),
819 .regset_get = dscr_get, .set = dscr_set
822 #ifdef CONFIG_PPC_BOOK3S_64
824 .core_note_type = NT_PPC_TAR, .n = 1,
825 .size = sizeof(u64), .align = sizeof(u64),
826 .regset_get = tar_get, .set = tar_set
829 .core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
830 .size = sizeof(u64), .align = sizeof(u64),
831 .active = ebb_active, .regset_get = ebb_get, .set = ebb_set
836 static const struct user_regset_view user_ppc_compat_view = {
837 .name = "ppc", .e_machine = EM_PPC, .ei_osabi = ELF_OSABI,
838 .regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets)
841 const struct user_regset_view *task_user_regset_view(struct task_struct *task)
843 if (IS_ENABLED(CONFIG_PPC64) && test_tsk_thread_flag(task, TIF_32BIT))
844 return &user_ppc_compat_view;
845 return &user_ppc_native_view;