Skip to contentSkip to conversation

score: add ptrace regsets support for score.

PATCH New Chen Liqin 1 participant 1 message Jul 15, 2009

Subsystems (3)
lore
Share & tools
lore

Chen Liqin

author
#0 lore raw

PATCH v3 1/1 score: add ptrace regsets support for score.

From 417a404114f3d69d42a9bb29258d67b08512c9d0 Mon Sep 17 00:00:00 2001
From: Chen Liqin <[email protected]>
Date: Wed, 15 Jul 2009 13:52:41 +0800
Subject: [PATCH V3] score: add ptrace regsets support for score. ptrace.c add register sets support for score architecture.

- genregs_get(struct task_struct *target,
const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
Retrieve the contents of score userspace general registers.

- genregs_set(struct task_struct *target,
const struct user_regset *regset,
unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf)
Update the contents of the score userspace general registers.

- remove PTRACE_PEEKUSR and PTRACE_POKEUSR code from arch_ptrace.

---
 arch/score/include/asm/elf.h    |   18 ++--
 arch/score/include/asm/ptrace.h |    8 +-
 arch/score/include/asm/user.h   |   17 +++
 arch/score/kernel/ptrace.c      |  211 ++++++++++++++++++---------------------
 4 files changed, 129 insertions(+), 125 deletions(-)
arch/score/include/asm/elf.h +11 -7
index 8324363..43526d9 100644
@@ -1,9 +1,8 @@
 #ifndef _ASM_SCORE_ELF_H
 #define _ASM_SCORE_ELF_H
 
-/* ELF register definitions */
-#define ELF_NGREG	45
-#define ELF_NFPREG	33
+#include <linux/ptrace.h>
+
 #define EM_SCORE7	135
 
 /* Relocation types. */
@@ -30,11 +29,15 @@
 #define R_SCORE_IMM30		20
 #define R_SCORE_IMM32		21
 
-typedef unsigned long elf_greg_t;
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+/* ELF register definitions */
+typedef unsigned long	elf_greg_t;
+
+#define ELF_NGREG	(sizeof(struct pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t	elf_gregset_t[ELF_NGREG];
 
-typedef double elf_fpreg_t;
-typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+/* Score does not have fp regs. */
+typedef double		elf_fpreg_t;
+typedef elf_fpreg_t	elf_fpregset_t;
 
 #define elf_check_arch(x)	((x)->e_machine == EM_SCORE7)
 
@@ -57,6 +60,7 @@ do {								\
 struct task_struct;
 struct pt_regs;
 
+#define CORE_DUMP_USE_REGSET
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE	PAGE_SIZE
 
arch/score/include/asm/ptrace.h +5 -3
index 66b14c8..d40e691 100644
@@ -51,9 +51,11 @@
  * system call/exception. As usual the registers k0/k1 aren't being saved.
  */
 struct pt_regs {
-	unsigned long pad0[6];
+	unsigned long pad0[6];	/* stack arguments */
 	unsigned long orig_r4;
 	unsigned long orig_r7;
+	long is_syscall;
+
 	unsigned long regs[32];
 
 	unsigned long cel;
@@ -68,12 +70,12 @@ struct pt_regs {
 	unsigned long cp0_psr;
 	unsigned long cp0_ecr;
 	unsigned long cp0_condition;
-
-	long is_syscall;
 };
 
 #ifdef __KERNEL__
 
+struct task_struct;
+
 /*
  * Does the process account for user or for system time?
  */
arch/score/include/asm/user.h +17 -0
index 3cf7572..7bfb8e2 100644
@@ -1,4 +1,21 @@
 #ifndef _ASM_SCORE_USER_H
 #define _ASM_SCORE_USER_H
 
+struct user_regs_struct {
+	unsigned long regs[32];
+
+	unsigned long cel;
+	unsigned long ceh;
+
+	unsigned long sr0;	/* cnt */
+	unsigned long sr1;	/* lcr */
+	unsigned long sr2;	/* scr */
+
+	unsigned long cp0_epc;
+	unsigned long cp0_ema;
+	unsigned long cp0_psr;
+	unsigned long cp0_ecr;
+	unsigned long cp0_condition;
+};
+
 #endif /* _ASM_SCORE_USER_H */
arch/score/kernel/ptrace.c +96 -115

238 lines not on this page · raw message

Signature · 1 line
1.6.2