• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Return codes: 1 - ok, 0 - ignore, other - error. */
2 static int
arch_get_scno(struct tcb * tcp)3 arch_get_scno(struct tcb *tcp)
4 {
5 	kernel_ulong_t scno = 0;
6 
7 	if (upeek(tcp, REG_A3, &alpha_a3) < 0)
8 		return -1;
9 	if (upeek(tcp, REG_R0, &scno) < 0)
10 		return -1;
11 
12 	/*
13 	 * Do some sanity checks to figure out if it's
14 	 * really a syscall entry
15 	 */
16 	if (!scno_in_range(scno)) {
17 		if (alpha_a3 == 0 || alpha_a3 == -1UL) {
18 			if (debug_flag)
19 				error_msg("stray syscall exit: r0 = %lu", scno);
20 			return 0;
21 		}
22 	}
23 
24 	tcp->scno = scno;
25 	return 1;
26 }
27