1 /* Note: we support only 32-bit CPUs, not 26-bit */ 2 3 #if !defined(__ARM_EABI__) || ENABLE_ARM_OABI 4 if (arm_regs.ARM_cpsr & 0x20) { 5 /* Thumb mode */ 6 goto scno_in_r7; 7 } 8 /* ARM mode */ 9 /* Check EABI/OABI by examining SVC insn's low 24 bits */ 10 errno = 0; 11 scno = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *)(arm_regs.ARM_pc - 4), NULL); 12 if (errno) 13 return -1; 14 /* EABI syscall convention? */ 15 if ((unsigned long) scno != 0xef000000) { 16 /* No, it's OABI */ 17 if ((scno & 0x0ff00000) != 0x0f900000) { 18 fprintf(stderr, "pid %d unknown syscall trap 0x%08lx\n", 19 tcp->pid, scno); 20 return -1; 21 } 22 /* Fixup the syscall number */ 23 scno &= 0x000fffff; 24 } else { 25 scno_in_r7: 26 scno = arm_regs.ARM_r7; 27 } 28 #else /* __ARM_EABI__ || !ENABLE_ARM_OABI */ 29 30 scno = arm_regs.ARM_r7; 31 32 #endif 33 34 scno = shuffle_scno(scno); 35 36 /* 37 * Do some sanity checks to figure out 38 * whether it's really a syscall entry. 39 */ 40 if (arm_regs.ARM_ip && !SCNO_IN_RANGE(scno)) { 41 if (debug_flag) 42 fprintf(stderr, 43 "pid %d stray syscall exit: ARM_ip = %ld, scno = %ld\n", 44 tcp->pid, arm_regs.ARM_ip, shuffle_scno(scno)); 45 return 0; 46 } 47