When the syscall number has to be loaded from a pc-relative location,
authormiod <miod@openbsd.org>
Wed, 27 Mar 2024 20:03:29 +0000 (20:03 +0000)
committermiod <miod@openbsd.org>
Wed, 27 Mar 2024 20:03:29 +0000 (20:03 +0000)
commitfc31befaf105b97a112f7671f6f1ed3695619019
tree6a9276c0d570f7c20ac6aee2d7b7b65173cf3ad3
parent1b1e48261cbbae6a9ff76342d13bed3fc963929f
When the syscall number has to be loaded from a pc-relative location,
abuse END macros to place the number at the end of the syscall wrapper
rather than in the middle of it, so that there is no need to branch
around it; this saves two instructions per syscall number >= 128.

While there, also tweak the error return (SET_ERRNO_AND_RETURN) to only
return a 64-bit value for lseek; this saves another instruction for
all other syscalls.

With input from guenther@; "Anything that makes the machine faster" deraadt@
lib/libc/arch/sh/SYS.h
lib/libc/arch/sh/sys/brk.S
lib/libc/arch/sh/sys/sbrk.S
lib/libc/arch/sh/sys/sigprocmask.S
lib/libc/arch/sh/sys/sigsuspend.S
lib/libc/arch/sh/sys/tfork_thread.S