1 /*
2 * Copyright (c) 2016-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 static int
9 arch_set_error(struct tcb *tcp)
10 {
11 kernel_ulong_t rval = -(long) tcp->u_error;
12
13 if (tcp->currpers == 1)
14 i386_regs.eax = rval;
15 else
16 x86_64_regs.rax = rval;
17
18 return upoke(tcp, 8 * RAX, rval);
19 }
20
21 static int
22 arch_set_success(struct tcb *tcp)
23 {
24 kernel_ulong_t rval = (kernel_ulong_t) tcp->u_rval;
25
26 if (tcp->currpers == 1)
27 i386_regs.eax = rval;
28 else
29 x86_64_regs.rax = rval;
30
31 return upoke(tcp, 8 * RAX, rval);
32 }