Skip to content

Commit 430143b

Browse files
committed
sparc: fix v4.10-25-g8497b62 fallout
Before: $ sleep 3 & ./strace -p $! Process 8703 attached syscall: unknown syscall trap 1a800003 00025d58 syscall_516(0, 0x40080000, 0, 0xfc000f00, 0x28, 0xefc03b18) = 0 exit_group(0) = ? +++ exited with 0 +++ After: $ sleep 3 & ./strace -p $! Process 8725 attached restart_syscall(<... resuming interrupted nanosleep ...>) = 0 exit_group(0) = ? +++ exited with 0 +++ Signed-off-by: Denys Vlasenko <[email protected]>
1 parent ea00900 commit 430143b

File tree

1 file changed

+4
-45
lines changed

1 file changed

+4
-45
lines changed

linux/sparc/get_scno.c

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
/* Disassemble the syscall trap. */
1+
#ifdef SPARC64
22
/* Retrieve the syscall trap instruction. */
33
unsigned long trap;
4-
54
errno = 0;
6-
7-
#ifdef SPARC64
85
trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)sparc_regs.tpc, 0);
9-
trap >>= 32;
10-
#else
11-
trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)sparc_regs.pc, 0);
12-
#endif
13-
146
if (errno)
157
return -1;
16-
17-
/* Disassemble the trap to see what personality to use. */
8+
trap >>= 32;
189
switch (trap) {
1910
case 0x91d02010:
2011
/* Linux/SPARC syscall trap. */
@@ -24,39 +15,7 @@ case 0x91d0206d:
2415
/* Linux/SPARC64 syscall trap. */
2516
update_personality(tcp, 2);
2617
break;
27-
case 0x91d02000:
28-
/* SunOS syscall trap. (pers 1) */
29-
fprintf(stderr, "syscall: SunOS no support\n");
30-
return -1;
31-
case 0x91d02008:
32-
/* Solaris 2.x syscall trap. (per 2) */
33-
update_personality(tcp, 1);
34-
break;
35-
case 0x91d02009:
36-
/* NetBSD/FreeBSD syscall trap. */
37-
fprintf(stderr, "syscall: NetBSD/FreeBSD not supported\n");
38-
return -1;
39-
case 0x91d02027:
40-
/* Solaris 2.x gettimeofday */
41-
update_personality(tcp, 1);
42-
break;
43-
default:
44-
#ifdef SPARC64
45-
fprintf(stderr, "syscall: unknown syscall trap %08lx %016lx\n", trap, sparc_regs.tpc);
46-
#else
47-
fprintf(stderr, "syscall: unknown syscall trap %08lx %08lx\n", trap, sparc_regs.pc);
48-
#endif
49-
return -1;
50-
}
51-
52-
/* Extract the system call number from the registers. */
53-
if (trap == 0x91d02027) {
54-
scno = 156;
55-
} else {
56-
scno = sparc_regs.u_regs[U_REG_G1];
5718
}
19+
#endif
5820

59-
if (scno == 0) {
60-
scno = sparc_regs.u_regs[U_REG_O0];
61-
memmove(&sparc_regs.u_regs[U_REG_O0], &sparc_regs.u_regs[U_REG_O1], 7*sizeof(sparc_regs.u_regs[0]));
62-
}
21+
scno = sparc_regs.u_regs[U_REG_G1];

0 commit comments

Comments
 (0)