1 /*
2 * Copyright (c) 2015-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #include "negated_errno.h"
9
10 static void
11 arch_get_error(struct tcb *tcp, const bool check_errno)
12 {
13 if (PPC_TRAP_IS_SCV(ppc_regs.trap)) {
14 if (check_errno && is_negated_errno(ppc_regs.gpr[3])) {
15 tcp->u_rval = -1;
16 tcp->u_error = -ppc_regs.gpr[3];
17 } else {
18 tcp->u_rval = ppc_regs.gpr[3];
19 }
20 } else {
21 if (ppc_regs.ccr & 0x10000000) {
22 tcp->u_rval = -1;
23 tcp->u_error = ppc_regs.gpr[3];
24 } else {
25 tcp->u_rval = ppc_regs.gpr[3];
26 }
27 }
28 }