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