path: root/src/signal/sh/restore.s
diff options
authorRich Felker <>2015-06-16 15:25:02 +0000
committerRich Felker <>2015-06-16 15:25:02 +0000
commit10d0268ccfab9152250eeeed3952ce3fed44131a (patch)
treee5584cc6b44eb7405530d7c558c59e3ca495c6c3 /src/signal/sh/restore.s
parent3366a99b17847b58f2d8cc52cbb5d65deb824f8a (diff)
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.
Diffstat (limited to 'src/signal/sh/restore.s')
1 files changed, 2 insertions, 2 deletions
diff --git a/src/signal/sh/restore.s b/src/signal/sh/restore.s
index ab26034b..eaedcdfb 100644
--- a/src/signal/sh/restore.s
+++ b/src/signal/sh/restore.s
@@ -2,7 +2,7 @@
.type __restore, @function
mov #119, r3 !__NR_sigreturn
- trapa #16
+ trapa #31
or r0, r0
or r0, r0
@@ -15,7 +15,7 @@ __restore:
mov #100, r3 !__NR_rt_sigreturn
add #73, r3
- trapa #16
+ trapa #31
or r0, r0
or r0, r0