1 // SPDX-License-Identifier: GPL-2.0-only
3 * System call callback functions for SPUs
8 #include <linux/kallsyms.h>
9 #include <linux/export.h>
10 #include <linux/syscalls.h>
13 #include <asm/syscalls.h>
14 #include <asm/unistd.h>
17 * This table defines the system calls that an SPU can call.
18 * It is currently a subset of the 64 bit powerpc system calls,
19 * with the exact semantics.
21 * The reasons for disabling some of the system calls are:
22 * 1. They interact with the way SPU syscalls are handled
23 * and we can't let them execute ever:
24 * restart_syscall, exit, for, execve, ptrace, ...
25 * 2. They are deprecated and replaced by other means:
26 * uselib, pciconfig_*, sysfs, ...
27 * 3. They are somewhat interacting with the system in a way
28 * we don't want an SPU to:
29 * reboot, init_module, mount, kexec_load
30 * 4. They are optional and we can't rely on them being
31 * linked into the kernel. Unfortunately, the cond_syscall
32 * helper does not work here as it does not add the necessary
34 * mbind, mq_open, ipc, ...
37 static void *spu_syscall_table[] = {
38 #define __SYSCALL(nr, entry) [nr] = entry,
39 #include <asm/syscall_table_spu.h>
43 long spu_sys_callback(struct spu_syscall_block *s)
45 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
47 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
48 pr_debug("%s: invalid syscall #%lld", __func__, s->nr_ret);
52 syscall = spu_syscall_table[s->nr_ret];
54 pr_debug("SPU-syscall "
55 "%pSR:syscall%lld(%llx, %llx, %llx, %llx, %llx, %llx)\n",
58 s->parm[0], s->parm[1], s->parm[2],
59 s->parm[3], s->parm[4], s->parm[5]);
61 return syscall(s->parm[0], s->parm[1], s->parm[2],
62 s->parm[3], s->parm[4], s->parm[5]);
64 EXPORT_SYMBOL_GPL(spu_sys_callback);