• 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 	/* Retrieve the syscall trap instruction. */
6 	unsigned long trap;
7 	errno = 0;
8 	trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *) sparc_regs.tpc, 0);
9 	if (errno == 0) {
10 		trap >>= 32;
11 		switch (trap) {
12 		case 0x91d02010:
13 			/* Linux/SPARC syscall trap. */
14 			update_personality(tcp, 1);
15 			break;
16 		case 0x91d0206d:
17 			/* Linux/SPARC64 syscall trap. */
18 			update_personality(tcp, 0);
19 			break;
20 		}
21 	}
22 
23 	tcp->scno = sparc_regs.u_regs[U_REG_G1];
24 	return 1;
25 }
26