summaryrefslogtreecommitdiff
path: root/linux/sparc64/set_error.c
blob: 10eb380fc99bd692fb1b0cb8d7b19432a075e6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 2016-2019 The strace developers.
 * All rights reserved.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

static int
sparc64_set_o0_tstate(struct tcb *tcp, const unsigned long o0,
		      const unsigned long tstate_set,
		      const unsigned long tstate_clear)
{
	if (ptrace_syscall_info_is_valid() && get_regs(tcp) < 0)
		return -1;
	sparc_regs.u_regs[U_REG_O0] = o0;
	sparc_regs.tstate |= tstate_set;
	sparc_regs.tstate &= ~tstate_clear;
	return set_regs(tcp->pid);
}

static int
arch_set_error(struct tcb *tcp)
{
	return sparc64_set_o0_tstate(tcp, tcp->u_error, 0x1100000000UL, 0);
}

static int
arch_set_success(struct tcb *tcp)
{
	return sparc64_set_o0_tstate(tcp, tcp->u_rval, 0, 0x1100000000UL);
}