MIPS: Respect the legacy syscall restart convention.
authorMaciej W. Rozycki <macro@codesourcery.com>
Tue, 5 Feb 2013 14:41:32 +0000 (14:41 +0000)
committerMaciej W. Rozycki <macro@codesourcery.com>
Tue, 5 Feb 2013 14:55:20 +0000 (14:55 +0000)
commitb82ba2f011fc4628ceece07412846d0b4d50cac2
tree58b00169b96ca952724f0ca2e1d8c1f3969e3d17
parent9a0d1941d30221ed8875ebef4c080bd726740802
MIPS: Respect the legacy syscall restart convention.

That convention requires the instruction immediately preceding SYSCALL
to initialize $v0 with the syscall number.  Then if a restart triggers,
$v0 will have been clobbered by the syscall interrupted, and needs to be
reinititalized.  The kernel will decrement the PC by 4 before switching
back to the user mode so that $v0 has been reloaded before SYSCALL is
executed again.  This implies the place $v0 is loaded from must be
preserved across a syscall, e.g. an immediate, static register, stack
slot, etc.

The restriction was lifted with Linux 2.6.36 kernel release and no
special requirements are placed around the SYSCALL instruction anymore,
however we still support older kernel binaries.
NEWS
ports/ChangeLog.mips
ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h