Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/trace/linux/
Date: Sun, 20 Dec 2015 19:13:49
Message-Id: 1450638765.88e312a1a6223a2c06b6a41ec7dc5482f3a413fa.vapier@gentoo
1 commit: 88e312a1a6223a2c06b6a41ec7dc5482f3a413fa
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 20 19:12:45 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 20 19:12:45 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=88e312a1
7
8 libsandbox: new powerpc ptrace port
9
10 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
11
12 libsandbox/trace/linux/arch.c | 2 ++
13 libsandbox/trace/linux/powerpc.c | 30 ++++++++++++++++++++++++++++++
14 2 files changed, 32 insertions(+)
15
16 diff --git a/libsandbox/trace/linux/arch.c b/libsandbox/trace/linux/arch.c
17 index 1515abe..fbf5b79 100644
18 --- a/libsandbox/trace/linux/arch.c
19 +++ b/libsandbox/trace/linux/arch.c
20 @@ -17,6 +17,8 @@
21 # include "hppa.c"
22 #elif defined(__i386__)
23 # include "i386.c"
24 +#elif defined(__powerpc__)
25 +# include "powerpc.c"
26 #elif defined(__s390__)
27 # include "s390.c"
28 #elif defined(__sparc__)
29
30 diff --git a/libsandbox/trace/linux/powerpc.c b/libsandbox/trace/linux/powerpc.c
31 new file mode 100644
32 index 0000000..6e9152c
33 --- /dev/null
34 +++ b/libsandbox/trace/linux/powerpc.c
35 @@ -0,0 +1,30 @@
36 +/* 32-bit & 64-bit systems use the same syscall table, so handling
37 + * multiple personalities is simple -- nothing to do!
38 + */
39 +
40 +#define trace_reg_sysnum gpr[0]
41 +
42 +static long trace_raw_ret(void *vregs)
43 +{
44 + trace_regs *regs = vregs;
45 + return regs->gpr[3];
46 +}
47 +
48 +static void trace_set_ret(void *vregs, int err)
49 +{
50 + trace_regs *regs = vregs;
51 + regs->gpr[0] = -1;
52 + regs->gpr[3] = err;
53 + trace_set_regs(regs);
54 +}
55 +
56 +static unsigned long trace_arg(void *vregs, int num)
57 +{
58 + trace_regs *regs = vregs;
59 + if (num == 1)
60 + return regs->orig_gpr3;
61 + if (num < 7)
62 + return regs->gpr[3 + num - 1];
63 + else
64 + return -1;
65 +}