Path: blob/master/arch/powerpc/platforms/cell/spu_callbacks.c
26481 views
// SPDX-License-Identifier: GPL-2.0-only1/*2* System call callback functions for SPUs3*/45#undef DEBUG67#include <linux/kallsyms.h>8#include <linux/export.h>9#include <linux/syscalls.h>1011#include <asm/spu.h>12#include <asm/syscalls.h>13#include <asm/unistd.h>1415/*16* This table defines the system calls that an SPU can call.17* It is currently a subset of the 64 bit powerpc system calls,18* with the exact semantics.19*20* The reasons for disabling some of the system calls are:21* 1. They interact with the way SPU syscalls are handled22* and we can't let them execute ever:23* restart_syscall, exit, for, execve, ptrace, ...24* 2. They are deprecated and replaced by other means:25* uselib, pciconfig_*, sysfs, ...26* 3. They are somewhat interacting with the system in a way27* we don't want an SPU to:28* reboot, init_module, mount, kexec_load29* 4. They are optional and we can't rely on them being30* linked into the kernel. Unfortunately, the cond_syscall31* helper does not work here as it does not add the necessary32* opd symbols:33* mbind, mq_open, ipc, ...34*/3536static const syscall_fn spu_syscall_table[] = {37#define __SYSCALL_WITH_COMPAT(nr, entry, compat) __SYSCALL(nr, entry)38#define __SYSCALL(nr, entry) [nr] = (void *) entry,39#include <asm/syscall_table_spu.h>40};4142long spu_sys_callback(struct spu_syscall_block *s)43{44syscall_fn syscall;4546if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {47pr_debug("%s: invalid syscall #%lld", __func__, s->nr_ret);48return -ENOSYS;49}5051syscall = spu_syscall_table[s->nr_ret];5253pr_debug("SPU-syscall "54"%pSR:syscall%lld(%llx, %llx, %llx, %llx, %llx, %llx)\n",55syscall,56s->nr_ret,57s->parm[0], s->parm[1], s->parm[2],58s->parm[3], s->parm[4], s->parm[5]);5960return syscall(s->parm[0], s->parm[1], s->parm[2],61s->parm[3], s->parm[4], s->parm[5]);62}63EXPORT_SYMBOL_GPL(spu_sys_callback);646566