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 /* Return codes: 1 - ok, 0 - ignore, other - error. */
9 static int
10 arch_get_scno(struct tcb *tcp)
11 {
12 kernel_ulong_t scno = 0;
13
14 if (upeek(tcp, REG_A3, &alpha_a3) < 0)
15 return -1;
16 if (upeek(tcp, REG_R0, &scno) < 0)
17 return -1;
18
19 /*
20 * Do some sanity checks to figure out if it's
21 * really a syscall entry
22 */
23 if (!scno_in_range(scno)) {
24 if (alpha_a3 == 0 || alpha_a3 == -1UL) {
25 debug_msg("stray syscall exit: r0 = %lu", scno);
26 return 0;
27 }
28 }
29
30 tcp->scno = scno;
31 return 1;
32 }