diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-12-20 14:12:45 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-12-20 14:12:45 -0500 |
commit | 88e312a1a6223a2c06b6a41ec7dc5482f3a413fa (patch) | |
tree | e872f13c788ab4434582a4cf07a168d645723ab9 /libsandbox | |
parent | libsandbox: new alpha ptrace port (diff) | |
download | sandbox-88e312a1a6223a2c06b6a41ec7dc5482f3a413fa.tar.gz sandbox-88e312a1a6223a2c06b6a41ec7dc5482f3a413fa.tar.bz2 sandbox-88e312a1a6223a2c06b6a41ec7dc5482f3a413fa.zip |
libsandbox: new powerpc ptrace port
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r-- | libsandbox/trace/linux/arch.c | 2 | ||||
-rw-r--r-- | libsandbox/trace/linux/powerpc.c | 30 |
2 files changed, 32 insertions, 0 deletions
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; +} |