From 10d0268ccfab9152250eeeed3952ce3fed44131a Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 16 Jun 2015 15:25:02 +0000 Subject: switch to using trap number 31 for syscalls on sh nominally the low bits of the trap number on sh are the number of syscall arguments, but they have never been used by the kernel, and some code making syscalls does not even know the number of arguments and needs to pass an arbitrary high number anyway. sh3/sh4 traditionally used the trap range 16-31 for syscalls, but part of this range overlapped with hardware exceptions/interrupts on sh2 hardware, so an incompatible range 32-47 was chosen for sh2. using trap number 31 everywhere, since it's in the existing sh3/sh4 range and does not conflict with sh2 hardware, is a proposed unification of the kernel syscall convention that will allow binaries to be shared between sh2 and sh3/sh4. if this is not accepted into the kernel, we can refit the sh2 target with runtime selection mechanisms for the trap number, but doing so would be invasive and would entail non-trivial overhead. --- src/internal/sh/syscall.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/internal/sh') diff --git a/src/internal/sh/syscall.s b/src/internal/sh/syscall.s index d00712a9..331918a5 100644 --- a/src/internal/sh/syscall.s +++ b/src/internal/sh/syscall.s @@ -13,7 +13,7 @@ __syscall: mov.l @r15, r7 mov.l @(4,r15), r0 mov.l @(8,r15), r1 - trapa #22 + trapa #31 or r0, r0 or r0, r0 or r0, r0 -- cgit v1.2.3-70-g09d2