linux: set error flags in arch_set_error on POWER and Alpha

* alpha/set_error.c (arch_set_error): Set alpha_r3 to 1, update tracee's
REG_A3.
* powerpc/set_error.c (arch_set_error): Set bit 28 in CCR register,
update tracee's PT_CCR.

Fixes: v4.15~126 "Implement arch specific methods of changing syscall number and error code"
This commit is contained in:
Eugene Syromyatnikov 2018-06-10 14:25:37 +02:00 committed by Dmitry V. Levin
parent d2aa5046e9
commit 525f70debe
2 changed files with 5 additions and 3 deletions

View File

@ -1,8 +1,8 @@
static int
arch_set_error(struct tcb *tcp)
{
alpha_r0 = tcp->u_error;
return upoke(tcp, REG_R0, alpha_r0);
return upoke(tcp, REG_A3, (alpha_a3 = 1))
|| upoke(tcp, REG_R0, (alpha_r0 = tcp->u_error));
}
static int

View File

@ -2,8 +2,10 @@ static int
arch_set_error(struct tcb *tcp)
{
ppc_regs.gpr[3] = tcp->u_error;
ppc_regs.ccr |= 0x10000000;
#ifdef HAVE_GETREGS_OLD
return upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
return upoke(tcp, sizeof(long) * PT_CCR, ppc_regs.ccr) ||
upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
#else
return set_regs(tcp->pid);
#endif