diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-10-24 22:52:29 -0700 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-10-24 22:52:29 -0700 |
commit | f3b7a388d49383e092e7c09d514b698db644bb20 (patch) | |
tree | a0347a4c41b656ce91b7f91ea93c5575cd66be3b | |
parent | bump to configure-2.28 (diff) | |
download | sandbox-f3b7a388d49383e092e7c09d514b698db644bb20.tar.gz sandbox-f3b7a388d49383e092e7c09d514b698db644bb20.tar.bz2 sandbox-f3b7a388d49383e092e7c09d514b698db644bb20.zip |
libsandbox: port ptrace to sparc64 & re-enable for sparc
Now that we have a real dev system & userland running sparc64,
port the logic to it and make sure tests pass on 32-bit & 64-bit.
Hopefully the trace main loop rewrite to avoid signals should
address the instability issues we saw.
Closes: https://bugs.gentoo.org/293632
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | libsandbox/trace/linux/sparc.c | 18 |
2 files changed, 12 insertions, 7 deletions
@@ -70,6 +70,7 @@ It requires: * Itanium * PowerPC (32-bit & 64-bit) * s390 (32-bit & 64-bit) + * SPARC (32-bit & 64-bit) * x86 (32-bit & 64-bit & x32) * Operating system * [Linux](https://kernel.org/) 3.8+ diff --git a/libsandbox/trace/linux/sparc.c b/libsandbox/trace/linux/sparc.c index b59a036..cb1cb54 100644 --- a/libsandbox/trace/linux/sparc.c +++ b/libsandbox/trace/linux/sparc.c @@ -1,6 +1,3 @@ -#define SB_NO_TRACE_ARCH -#if 0 /* XXX: broken sometimes #293632 */ - /* Since sparc's g0 register is hardcoded to 0 in the ISA, the kernel does not * bother copying it out when using the regs ptrace. Instead it shifts things * by one and stores [g1..g7] in [0..6] and [o0..o7] in [7..14] (leaving the @@ -18,9 +15,14 @@ /* Sparc systems have swapped the addr/data args. */ #undef trace_get_regs -#define trace_get_regs(regs) do_ptrace(PTRACE_GETREGS, regs, NULL) #undef trace_set_regs -#define trace_set_regs(regs) do_ptrace(PTRACE_SETREGS, regs, NULL) +#ifdef __arch64__ +# define trace_get_regs(regs) do_ptrace(PTRACE_GETREGS64, regs, NULL) +# define trace_set_regs(regs) do_ptrace(PTRACE_SETREGS64, regs, NULL) +#else +# define trace_get_regs(regs) do_ptrace(PTRACE_GETREGS, regs, NULL) +# define trace_set_regs(regs) do_ptrace(PTRACE_SETREGS, regs, NULL) +#endif #define trace_reg_sysnum u_regs[U_REG_G1] @@ -33,8 +35,12 @@ static long trace_raw_ret(void *vregs) static void trace_set_ret(void *vregs, int err) { trace_regs *regs = vregs; +#ifndef __arch64__ /* The carry bit is used to flag errors. */ regs->psr |= PSR_C; +#else + regs->tstate |= 0x1100000000; +#endif /* Userland negates the value on sparc. */ regs->u_regs[U_REG_O0] = err; trace_set_regs(regs); @@ -48,5 +54,3 @@ static unsigned long trace_arg(void *vregs, int num) else return -1; } - -#endif |