commit:     88e312a1a6223a2c06b6a41ec7dc5482f3a413fa
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 19:12:45 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Dec 20 19:12:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=88e312a1

libsandbox: new powerpc ptrace port

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 libsandbox/trace/linux/arch.c    |  2 ++
 libsandbox/trace/linux/powerpc.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/libsandbox/trace/linux/arch.c b/libsandbox/trace/linux/arch.c
index 1515abe..fbf5b79 100644
--- a/libsandbox/trace/linux/arch.c
+++ b/libsandbox/trace/linux/arch.c
@@ -17,6 +17,8 @@
 # include "hppa.c"
 #elif defined(__i386__)
 # include "i386.c"
+#elif defined(__powerpc__)
+# include "powerpc.c"
 #elif defined(__s390__)
 # include "s390.c"
 #elif defined(__sparc__)

diff --git a/libsandbox/trace/linux/powerpc.c b/libsandbox/trace/linux/powerpc.c
new file mode 100644
index 0000000..6e9152c
--- /dev/null
+++ b/libsandbox/trace/linux/powerpc.c
@@ -0,0 +1,30 @@
+/* 32-bit & 64-bit systems use the same syscall table, so handling
+ * multiple personalities is simple -- nothing to do!
+ */
+
+#define trace_reg_sysnum gpr[0]
+
+static long trace_raw_ret(void *vregs)
+{
+       trace_regs *regs = vregs;
+       return regs->gpr[3];
+}
+
+static void trace_set_ret(void *vregs, int err)
+{
+       trace_regs *regs = vregs;
+       regs->gpr[0] = -1;
+       regs->gpr[3] = err;
+       trace_set_regs(regs);
+}
+
+static unsigned long trace_arg(void *vregs, int num)
+{
+       trace_regs *regs = vregs;
+       if (num == 1)
+               return regs->orig_gpr3;
+       if (num < 7)
+               return regs->gpr[3 + num - 1];
+       else
+               return -1;
+}

Reply via email to