[PATCH v2 08/14] powerpc: Use common syscall handler type
Andrew Donnellan
ajd at linux.ibm.com
Mon Aug 8 17:35:23 AEST 2022
On Mon, 2022-07-25 at 16:28 +1000, Rohan McLure wrote:
> Cause syscall handlers to be typed as follows when called indirectly
> throughout the kernel.
>
> typedef long (*syscall_fn)(unsigned long, unsigned long, unsigned
> long,
> unsigned long, unsigned long, unsigned
> long);
>
> Since both 32 and 64-bit abis allow for at least the first six
> machine-word length parameters to a function to be passed by
> registers,
> even handlers which admit fewer than six parameters may be viewed as
> having the above type.
>
> Fixup comparisons in VDSO to avoid pointer-integer comparison.
> Introduce
> explicit cast on systems with SPUs.
>
> Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
This patch needs rebasing on top of commit 1547db7d1f44 ("powerpc: Move
system_call_exception() to syscall.c").
>
> diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c
> b/arch/powerpc/platforms/cell/spu_callbacks.c
> index fe0d8797a00a..114bbe2eeacc 100644
> --- a/arch/powerpc/platforms/cell/spu_callbacks.c
> +++ b/arch/powerpc/platforms/cell/spu_callbacks.c
> @@ -34,22 +34,22 @@
> * mbind, mq_open, ipc, ...
> */
>
> -static void *spu_syscall_table[] = {
> +static const syscall_fn spu_syscall_table[] = {
> #define __SYSCALL_WITH_COMPAT(nr, entry, compat) __SYSCALL(nr,
> entry)
> -#define __SYSCALL(nr, entry) [nr] = entry,
> +#define __SYSCALL(nr, entry) [nr] = (void *) entry,
> #include <asm/syscall_table_spu.h>
> };
>
> long spu_sys_callback(struct spu_syscall_block *s)
> {
> - long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64
> a6);
> + syscall_fn syscall;
>
> if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
> pr_debug("%s: invalid syscall #%lld", __func__, s-
> >nr_ret);
> return -ENOSYS;
> }
>
> - syscall = spu_syscall_table[s->nr_ret];
> + syscall = (syscall_fn) spu_syscall_table[s->nr_ret];
I don't think this cast is necessary?
>
> pr_debug("SPU-syscall "
> "%pSR:syscall%lld(%llx, %llx, %llx, %llx, %llx,
> %llx)\n",
--
Andrew Donnellan OzLabs, ADL Canberra
ajd at linux.ibm.com IBM Australia Limited
More information about the Linuxppc-dev
mailing list