1/* Return codes: 1 - ok, 0 - ignore, other - error. */ 2static int 3arch_get_scno(struct tcb *tcp) 4{ 5 kernel_ulong_t scno = 0; 6 7 /* 8 * In the new syscall ABI, the system call number is in R3. 9 */ 10 if (upeek(tcp->pid, 4*(REG_REG0+3), &scno) < 0) 11 return -1; 12 13 if ((long) scno < 0) { 14 /* Odd as it may seem, a glibc bug has been known to cause 15 glibc to issue bogus negative syscall numbers. So for 16 our purposes, make strace print what it *should* have been */ 17 kernel_ulong_t correct_scno = (scno & 0xff); 18 if (debug_flag) 19 error_msg("Detected glibc bug: bogus system call" 20 " number = %ld, correcting to %ld", 21 scno, correct_scno); 22 scno = correct_scno; 23 } 24 25 tcp->scno = scno; 26 return 1; 27} 28