From 525f70debea0f7e725fd3be0e9bc8df6f9f3a2c9 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Sun, 10 Jun 2018 14:25:37 +0200 Subject: [PATCH] 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" --- linux/alpha/set_error.c | 4 ++-- linux/powerpc/set_error.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/linux/alpha/set_error.c b/linux/alpha/set_error.c index 169277bc..78a247e5 100644 --- a/linux/alpha/set_error.c +++ b/linux/alpha/set_error.c @@ -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 diff --git a/linux/powerpc/set_error.c b/linux/powerpc/set_error.c index 38ae32bb..602ca15e 100644 --- a/linux/powerpc/set_error.c +++ b/linux/powerpc/set_error.c @@ -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 -- 2.40.0