root/arch/powerpc/platforms/cell/spu_callbacks.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. spu_sys_callback

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  * System call callback functions for SPUs
   4  */
   5 
   6 #undef DEBUG
   7 
   8 #include <linux/kallsyms.h>
   9 #include <linux/export.h>
  10 #include <linux/syscalls.h>
  11 
  12 #include <asm/spu.h>
  13 #include <asm/syscalls.h>
  14 #include <asm/unistd.h>
  15 
  16 /*
  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.
  20  *
  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
  33  *    opd symbols:
  34  *      mbind, mq_open, ipc, ...
  35  */
  36 
  37 static void *spu_syscall_table[] = {
  38 #define __SYSCALL(nr, entry)    entry,
  39 #include <asm/syscall_table_spu.h>
  40 #undef __SYSCALL
  41 };
  42 
  43 long spu_sys_callback(struct spu_syscall_block *s)
  44 {
  45         long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
  46 
  47         if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
  48                 pr_debug("%s: invalid syscall #%lld", __func__, s->nr_ret);
  49                 return -ENOSYS;
  50         }
  51 
  52         syscall = spu_syscall_table[s->nr_ret];
  53 
  54         pr_debug("SPU-syscall "
  55                  "%pSR:syscall%lld(%llx, %llx, %llx, %llx, %llx, %llx)\n",
  56                  syscall,
  57                  s->nr_ret,
  58                  s->parm[0], s->parm[1], s->parm[2],
  59                  s->parm[3], s->parm[4], s->parm[5]);
  60 
  61         return syscall(s->parm[0], s->parm[1], s->parm[2],
  62                        s->parm[3], s->parm[4], s->parm[5]);
  63 }
  64 EXPORT_SYMBOL_GPL(spu_sys_callback);

/* [<][>][^][v][top][bottom][index][help] */