Support for the OpenRISC 1000 platform.

Christian Svensson blue at cmd.nu
Mon Feb 11 21:41:39 UTC 2013


On Mon, Feb 11, 2013 at 9:37 PM, Christian Svensson <blue at cmd.nu> wrote:
> The following patch adds support for the or1k architecture.
> This architecture has been in mainline Linux since 3.1.
>
> Feel free to give harsh feedback and other comments :-).
>
> Support for the OpenRISC 1000 platform.
>

While fixing a bug in glibc I discovered that the default ptrace
prototype hack stopped working.
This is patch improves the last patch (apply after the first one).

Sorry for the noise.

Do not use hacked prototype for or1k.

	* defs.h: Use sys/ptrace.h for or1k.
	* syscall.c: Fix arguments for sys/ptrace.h.
	* util.c: Likewise.
---
 defs.h    | 3 ++-
 syscall.c | 3 +--
 util.c    | 8 ++++++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/defs.h b/defs.h
index bfa765e..c7903a1 100644
--- a/defs.h
+++ b/defs.h
@@ -134,7 +134,8 @@ extern char *stpcpy(char *dst, const char *src);
 # define LINUX_MIPS64
 #endif

-#if (defined(LINUXSPARC) || defined(X86_64) || defined(ARM) ||
defined(AARCH64) || defined(AVR32)) && defined(__GLIBC__)
+#if (defined(LINUXSPARC) || defined(X86_64) || defined(ARM) ||
defined(AARCH64) \
+    || defined(OR1K) || defined(AVR32)) && defined(__GLIBC__)
 # include <sys/ptrace.h>
 #else
 /* Work around awkward prototype in ptrace.h. */
diff --git a/syscall.c b/syscall.c
index 053a8e5..473e4ce 100644
--- a/syscall.c
+++ b/syscall.c
@@ -898,8 +898,7 @@ void get_regs(pid_t pid)
 # elif defined(TILE)
 	get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, (long) &tile_regs);
 # elif defined(OR1K)
-	get_regs_error = ptrace(PTRACE_GETREGSET, pid, (void *)NT_PRSTATUS,
-	    (long)&or1k_io);
+	get_regs_error = ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &or1k_io);
 # endif
 }
 #endif
diff --git a/util.c b/util.c
index 2798350..56e0390 100644
--- a/util.c
+++ b/util.c
@@ -44,6 +44,10 @@
 # include <asm/rse.h>
 #endif

+#if defined(OR1K)
+# include <elf.h>
+#endif
+
 #ifdef HAVE_SYS_REG_H
 # include <sys/reg.h>
 # define PTRACE_PEEKUSR PTRACE_PEEKUSER
@@ -1292,10 +1296,10 @@ change_syscall(struct tcb *tcp,
arg_setup_state *state, int new)
 		return -1;
 	return 0;
 #elif defined(OR1K)
-	if (ptrace(PTRACE_GETREGSET, tcp->pid, (void*)1, (long)&or1k_regs) < 0)
+	if (ptrace(PTRACE_GETREGSET, tcp->pid, NT_PRSTATUS, &or1k_regs) < 0)
 		return -1;
 	or1k_regs.gpr[11] = new;
-	if (ptrace(PTRACE_SETREGSET, tcp->pid, (void*)1, (long)&or1k_regs) < 0)
+	if (ptrace(PTRACE_SETREGSET, tcp->pid, NT_PRSTATUS, &or1k_regs) < 0)
 		return -1;
 #else
 #warning Do not know how to handle change_syscall for this architecture
-- 
1.8.1.2




More information about the Strace-devel mailing list