diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-10-22 04:31:22 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-10-22 04:38:30 -0400 |
commit | 631faca297db746883ebab340a07bc6b910445bf (patch) | |
tree | 88e2bc37310580d59f98594205ddf8ab81b8c385 /libsandbox | |
parent | Remove leftover generated Makefiles from the repo (sic!) (diff) | |
download | sandbox-631faca297db746883ebab340a07bc6b910445bf.tar.gz sandbox-631faca297db746883ebab340a07bc6b910445bf.tar.bz2 sandbox-631faca297db746883ebab340a07bc6b910445bf.zip |
libsandbox: fix ppc ptrace return value setting
Forcing errors in the powerpc interface is a little finicky.
Fix it up so all the tests pass now on ppc32 & ppc64.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r-- | libsandbox/trace/linux/powerpc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libsandbox/trace/linux/powerpc.c b/libsandbox/trace/linux/powerpc.c index 6e9152c..b7fb76a 100644 --- a/libsandbox/trace/linux/powerpc.c +++ b/libsandbox/trace/linux/powerpc.c @@ -13,8 +13,14 @@ static long trace_raw_ret(void *vregs) static void trace_set_ret(void *vregs, int err) { trace_regs *regs = vregs; - regs->gpr[0] = -1; - regs->gpr[3] = err; + if ((regs->trap & 0xfff0) == 0x3000) { + /* ppc64 */ + regs->gpr[3] = -err; + } else { + /* ppc32 */ + regs->gpr[3] = err; + regs->ccr |= 0x10000000; + } trace_set_regs(regs); } |