Path: blob/master/arch/powerpc/platforms/cell/spu_callbacks.c
10818 views
/*1* System call callback functions for SPUs2*/34#undef DEBUG56#include <linux/kallsyms.h>7#include <linux/module.h>8#include <linux/syscalls.h>910#include <asm/spu.h>11#include <asm/syscalls.h>12#include <asm/unistd.h>1314/*15* This table defines the system calls that an SPU can call.16* It is currently a subset of the 64 bit powerpc system calls,17* with the exact semantics.18*19* The reasons for disabling some of the system calls are:20* 1. They interact with the way SPU syscalls are handled21* and we can't let them execute ever:22* restart_syscall, exit, for, execve, ptrace, ...23* 2. They are deprecated and replaced by other means:24* uselib, pciconfig_*, sysfs, ...25* 3. They are somewhat interacting with the system in a way26* we don't want an SPU to:27* reboot, init_module, mount, kexec_load28* 4. They are optional and we can't rely on them being29* linked into the kernel. Unfortunately, the cond_syscall30* helper does not work here as it does not add the necessary31* opd symbols:32* mbind, mq_open, ipc, ...33*/3435static void *spu_syscall_table[] = {36#define SYSCALL(func) sys_ni_syscall,37#define COMPAT_SYS(func) sys_ni_syscall,38#define PPC_SYS(func) sys_ni_syscall,39#define OLDSYS(func) sys_ni_syscall,40#define SYS32ONLY(func) sys_ni_syscall,41#define SYSX(f, f3264, f32) sys_ni_syscall,4243#define SYSCALL_SPU(func) sys_##func,44#define COMPAT_SYS_SPU(func) sys_##func,45#define PPC_SYS_SPU(func) ppc_##func,46#define SYSX_SPU(f, f3264, f32) f,4748#include <asm/systbl.h>49};5051long spu_sys_callback(struct spu_syscall_block *s)52{53long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);5455if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {56pr_debug("%s: invalid syscall #%lld", __func__, s->nr_ret);57return -ENOSYS;58}5960syscall = spu_syscall_table[s->nr_ret];6162#ifdef DEBUG63print_symbol(KERN_DEBUG "SPU-syscall %s:", (unsigned long)syscall);64printk("syscall%ld(%lx, %lx, %lx, %lx, %lx, %lx)\n",65s->nr_ret,66s->parm[0], s->parm[1], s->parm[2],67s->parm[3], s->parm[4], s->parm[5]);68#endif6970return syscall(s->parm[0], s->parm[1], s->parm[2],71s->parm[3], s->parm[4], s->parm[5]);72}73EXPORT_SYMBOL_GPL(spu_sys_callback);747576