[POWERPC] Add user_regset_view definitions
authorRoland McGrath <roland@redhat.com>
Thu, 20 Dec 2007 11:58:00 +0000 (03:58 -0800)
committerPaul Mackerras <paulus@samba.org>
Thu, 7 Feb 2008 09:40:16 +0000 (20:40 +1100)
This provides the task_user_regset_view entry point and support for
all the native-mode (64 on CONFIG_PPC64, 32 on CONFIG_PPC32) thread
register state.  This will enable generic machine-independent code to
access user-mode threads' registers for debugging and dumping.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/ptrace.c

index 58dbfeff9b4da46b51e1db726e9fefae1cb53f20..ac07112b65deaaafceff8f415085c42b248031d2 100644 (file)
@@ -2,6 +2,8 @@
 # Makefile for the linux kernel.
 #
 
+CFLAGS_ptrace.o                += -DUTS_MACHINE='"$(UTS_MACHINE)"'
+
 ifeq ($(CONFIG_PPC64),y)
 CFLAGS_prom_init.o     += -mno-minimal-toc
 endif
index d9b952faee733f1dec2be3c81848423e5d4bdf5a..eb00274e84ba9d67c9046772dbfad4b00bcdeafd 100644 (file)
@@ -455,6 +455,58 @@ static int set_evrregs(struct task_struct *task, unsigned long *data)
 #endif /* CONFIG_SPE */
 
 
+/*
+ * These are our native regset flavors.
+ */
+enum powerpc_regset {
+       REGSET_GPR,
+       REGSET_FPR,
+#ifdef CONFIG_ALTIVEC
+       REGSET_VMX,
+#endif
+#ifdef CONFIG_SPE
+       REGSET_SPE,
+#endif
+};
+
+static const struct user_regset native_regsets[] = {
+       [REGSET_GPR] = {
+               .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
+               .size = sizeof(long), .align = sizeof(long),
+               .get = gpr_get, .set = gpr_set
+       },
+       [REGSET_FPR] = {
+               .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
+               .size = sizeof(double), .align = sizeof(double),
+               .get = fpr_get, .set = fpr_set
+       },
+#ifdef CONFIG_ALTIVEC
+       [REGSET_VMX] = {
+               .core_note_type = NT_PPC_VMX, .n = 34,
+               .size = sizeof(vector128), .align = sizeof(vector128),
+               .active = vr_active, .get = vr_get, .set = vr_set
+       },
+#endif
+#ifdef CONFIG_SPE
+       [REGSET_SPE] = {
+               .n = 35,
+               .size = sizeof(u32), .align = sizeof(u32),
+               .active = evr_active, .get = evr_get, .set = evr_set
+       },
+#endif
+};
+
+static const struct user_regset_view user_ppc_native_view = {
+       .name = UTS_MACHINE, .e_machine = ELF_ARCH, .ei_osabi = ELF_OSABI,
+       .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+       return &user_ppc_native_view;
+}
+
+
 void user_enable_single_step(struct task_struct *task)
 {
        struct pt_regs *regs = task->thread.regs;