]> asedeno.scripts.mit.edu Git - linux.git/commit
sh: provide unified syscall trap compatible with all SH models
authorRich Felker <dalias@libc.org>
Thu, 17 Dec 2015 01:04:25 +0000 (01:04 +0000)
committerRich Felker <dalias@libc.org>
Thu, 17 Mar 2016 19:46:06 +0000 (19:46 +0000)
commit3623d138213aedf0e2c89720f6a3cd0e164cb310
tree09dfa5d4a2610f5b1b9b20e964a0ae82e2f64b61
parent940d4113f3306e07a1f86541489b686d1a979d54
sh: provide unified syscall trap compatible with all SH models

Historically SH-2 Linux (and originally uClinux) used a syscall
calling convention incompatible with the established SH-3/4 Linux ABI.
This choice was made because the trap range used by the existing ABI,
0x10-0x17, overlaps with the hardware exception/interrupt trap range
reserved by SH-2, and in particular, with the SH-2A divide-by-zero and
division-overflow exceptions.

Despite the documented syscall convention using the low bits of the
trap number to signal the number of arguments the kernel should
expect, no version of the kernel has ever used this information, nor
is it useful; all of the registers need to be saved anyway. Therefore,
it is possible to pick a new trap number, 0x1f, that is both supported
by all existing SH-3/4 kernels and unassigned as a hardware trap in
the SH-2 range. This makes it possible to produce SH-2 application
binaries that are forwards-compatible with running on SH-3/4 kernels
and to treat SH as a unified platform with varying ISA support levels
rather than multiple gratuitously-incompatible platforms.

This patch adjusts the range checking SH-2 and SH-2A kernels make for
the syscall trap to accept the range 0x1f-0x2f rather than just
0x20-0x2f. As a result, trap 0x1f now acts as a syscall for all SH
models.

Signed-off-by: Rich Felker <dalias@libc.org>
arch/sh/kernel/cpu/sh2/entry.S
arch/sh/kernel/cpu/sh2a/entry.S
arch/sh/kernel/entry-common.S