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 #define arch_get_error arm_get_error
11 #include "../arm/get_error.c"
12 #undef arch_get_error
13
14 static void
15 arch_get_error(struct tcb *tcp, const bool check_errno)
16 {
17 if (tcp->currpers == 1) {
18 arm_get_error(tcp, check_errno);
19 return;
20 }
21
22 if (check_errno && is_negated_errno(aarch64_regs.regs[0])) {
23 tcp->u_rval = -1;
24 tcp->u_error = -aarch64_regs.regs[0];
25 } else {
26 tcp->u_rval = aarch64_regs.regs[0];
27 }
28 }