From 4fce5f5bc8e2ad5cc04b730b241c24c72e1ae9fe Mon Sep 17 00:00:00 2001 From: "Peter H. Froehlich" Date: Tue, 22 Dec 2020 13:20:53 +0100 Subject: [PATCH] syscall.2: Update superh syscall convention I noticed this while working on some silly "hello, world" programs, see https://git.sr.ht/~phf/hello-again if you're curious. Disassembling sh4 code showed trap #31 all over the place but the syscall(2) man page talked about trap #0x17 and friends. Checking the kernel sources I got lucky in arch/sh/kernel/entry-common.S where in commit 3623d138213ae Rich Felker clarifies the situation. Signed-off-by: Michael Kerrisk --- man2/syscall.2 | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/man2/syscall.2 b/man2/syscall.2 index 986db9d11..87de539dd 100644 --- a/man2/syscall.2 +++ b/man2/syscall.2 @@ -216,7 +216,7 @@ powerpc64 sc r0 r3 - cr0.SO 1 riscv ecall a7 a0 a1 - s390 svc 0 r1 r2 r3 - 3 s390x svc 0 r1 r2 r3 - 3 -superh trap #0x17 r3 r0 r1 - 4, 6 +superh trapa #31 r3 r0 r1 - 4, 6 sparc/32 t 0x10 g1 o0 o1 psr/csr 1, 6 sparc/64 t 0x6d g1 o0 o1 psr/csr 1, 6 tile swint1 R10 R00 - R01 1 @@ -252,15 +252,9 @@ For s390 and s390x, .I "svc\ NR" if it is less than 256. .IP [4] -On SuperH, the trap number controls the maximum number of arguments passed. -A -.IR "trap\ #0x10" -can be used with only 0-argument system calls, a -.IR "trap\ #0x11" -can be used with 0- or 1-argument system calls, -and so on up to -.IR "trap #0x17" -for 7-argument system calls. +On SuperH additional trap numbers are supported for historic reasons, but +.BR trapa #31 +is the recommended "unified" ABI. .IP [5] The x32 ABI shares syscall table with x86-64 ABI, but there are some nuances: