1 #include <linux/file.h>
3 #include <linux/module.h>
4 #include <linux/mount.h>
5 #include <linux/namei.h>
7 #include <asm/uaccess.h>
12 * sys_spu_run - run code loaded into an SPU
14 * @unpc: next program counter for the SPU
15 * @ustatus: status of the SPU
17 * This system call transfers the control of execution of a
18 * user space thread to an SPU. It will return when the
19 * SPU has finished executing or when it hits an error
20 * condition and it will be interrupted if a signal needs
21 * to be delivered to a handler in user space.
23 * The next program counter is set to the passed value
24 * before the SPU starts fetching code and the user space
25 * pointer gets updated with the new value when returning
28 * The status value returned from spu_run reflects the
29 * value of the spu_status register after the SPU has stopped.
32 long do_spu_run(struct file
*filp
, __u32 __user
*unpc
, __u32 __user
*ustatus
)
35 struct spufs_inode_info
*i
;
39 if (get_user(npc
, unpc
) || get_user(status
, ustatus
))
43 if (filp
->f_vfsmnt
->mnt_sb
->s_magic
!= SPUFS_MAGIC
)
46 i
= SPUFS_I(filp
->f_dentry
->d_inode
);
47 ret
= spufs_run_spu(filp
, i
->i_ctx
, &npc
, &status
);
49 if (put_user(npc
, unpc
) || put_user(status
, ustatus
))
56 asmlinkage
long sys_spu_run(int fd
, __u32 __user
*unpc
, __u32 __user
*ustatus
)
63 filp
= fget_light(fd
, &fput_needed
);
65 ret
= do_spu_run(filp
, unpc
, ustatus
);
66 fput_light(filp
, fput_needed
);
73 asmlinkage
long sys_spu_create(const char __user
*pathname
,
74 unsigned int flags
, mode_t mode
)
79 tmp
= getname(pathname
);
84 ret
= path_lookup(tmp
, LOOKUP_PARENT
|
85 LOOKUP_OPEN
|LOOKUP_CREATE
, &nd
);
87 ret
= spufs_create_thread(&nd
, pathname
, flags
, mode
);
96 struct spufs_calls spufs_calls
= {
97 .create_thread
= sys_spu_create
,
98 .spu_run
= do_spu_run
,