sigreturn: make use of RVAL_DECODED

* sigreturn.c (arch_sigreturn): New function.
(sys_sigreturn): Use it.  Return RVAL_DECODED.
* linux/alpha/arch_sigreturn.c: Update.
* linux/crisv10/arch_sigreturn.c: Likewise.
* linux/m68k/arch_sigreturn.c: Likewise.
* linux/microblaze/arch_sigreturn.c: Likewise.
* linux/x86_64/arch_sigreturn.c: Likewise.
This commit is contained in:
Дмитрий Левин 2015-07-20 21:33:09 +00:00
parent eebb5616bf
commit fa6c0879c7
6 changed files with 17 additions and 12 deletions

View File

@ -1,7 +1,7 @@
long addr;
if (upeek(tcp->pid, REG_FP, &addr) < 0)
return 0;
return;
addr += offsetof(struct sigcontext, sc_mask);
tprints("{mask=");

View File

@ -2,7 +2,7 @@ long regs[PT_MAX + 1];
if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
perror_msg("sigreturn: PTRACE_GETREGS");
return 0;
return;
}
const long addr = regs[PT_USP] + offsetof(struct sigcontext, oldmask);

View File

@ -1,20 +1,20 @@
long addr;
if (upeek(tcp->pid, 4*PT_USP, &addr) < 0)
return 0;
return;
/* Fetch pointer to struct sigcontext. */
if (umove(tcp, addr + 2 * sizeof(int), &addr) < 0)
return 0;
return;
unsigned long mask[NSIG / 8 / sizeof(long)];
/* Fetch first word of signal mask. */
if (umove(tcp, addr, &mask[0]) < 0)
return 0;
return;
/* Fetch remaining words of signal mask, located immediately before. */
addr -= sizeof(mask) - sizeof(long);
if (umoven(tcp, addr, sizeof(mask) - sizeof(long), &mask[1]) < 0)
return 0;
return;
tprintsigmask_addr("{mask=", mask);
tprints("}");

View File

@ -4,7 +4,7 @@ long addr;
/* Read r1, the stack pointer. */
if (upeek(tcp->pid, 1 * 4, &addr) < 0)
return 0;
return;
addr += offsetof(struct sigcontext, oldmask);
tprints("{mask=");

View File

@ -5,6 +5,6 @@ if (current_personality != 1) {
tprints("{mask=");
print_sigset_addr_len(tcp, addr, NSIG / 8);
tprints("}");
return 0;
return;
}
#include "i386/arch_sigreturn.c"

View File

@ -14,10 +14,15 @@
# error NSIG < 32
#endif
static void
arch_sigreturn(struct tcb *tcp)
{
#include "arch_sigreturn.c"
}
SYS_FUNC(sigreturn)
{
if (entering(tcp)) {
#include "arch_sigreturn.c"
}
return 0;
arch_sigreturn(tcp);
return RVAL_DECODED;
}