• Rich Felker's avatar
    sh: provide unified syscall trap compatible with all SH models · 3623d138
    Rich Felker authored
    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: default avatarRich Felker <dalias@libc.org>
    3623d138
entry-common.S 8.68 KB