
- Linux System Calls
- Linux System Calls - Home
- A
- accept
- access
- acct
- add_key
- adjtimex
- afs_syscall
- alarm
- alloc_hugepages
- arch_prctl
- B
- bdflush
- bind
- break
- brk
- C
- cacheflush
- chdir
- chmod
- chown
- chroot
- clone2
- clone
- close
- connect
- create_module
- creat
- D
- dup2
- dup
- E
- epoll_create
- epoll_ctl
- epoll_wait
- execve
- exit_group
- _exit
- exit
- _Exit
- F
- faccessat
- fattch
- fchdir
- fchmodat
- fchmod
- fchownat
- fchown
- fcntl
- fdatasync
- fdetach
- flock
- fork
- free_hugepages
- fstatat
- fstatfs
- fstat
- fstatvfs
- fsync
- ftruncate
- futex
- futimesat
- G
- getcontext
- getcwd
- getdents
- getdomainname
- getdtablesize
- getegid
- geteuid
- getgid
- getgroups
- gethostid
- gethostname
- getitimer
- get_kernel_syms
- get_mempolicy
- getmsg
- getpagesize
- getpeername
- getpgid
- getpgrp
- getpid
- getpmsg
- getppid
- getpriority
- getresgid
- getresuid
- getrlimit
- get_robust_list
- getrusage
- getsid
- getsockname
- getsockopt
- get_thread_area
- gettid
- gettimeofday
- getuid
- getunwind
- gtty
- I
- idle
- inb
- inb_p
- init_module
- inl
- inl_p
- inotify_add_watch
- inotify_init
- inotify_rm_watch
- insb
- insl
- insw
- intro
- inw
- inw_p
- io_cancel
- ioctl
- ioctl_list
- io_destroy
- io_getevents
- ioperm
- iopl
- ioprio_get
- ioprio_set
- io_setup
- io_submit
- ipc
- isastream
- K
- kexec_load
- keyctl
- kill
- killpg
- L
- lchown
- linkat
- link
- listen
- _llseek
- llseek
- lock
- lookup_dcookie
- lseek
- lstat
- M
- madvise
- mincore
- mkdirat
- mkdir
- mknodat
- mknod
- mlockall
- mlock
- mmap2
- mmap
- modify_ldt
- mount
- move_pages
- mprotect
- mpx
- mq_getsetattr
- mremap
- msgctl
- msgget
- msgop
- msgrcv
- msgsnd
- msync
- multiplexer
- munlockall
- munlock
- munmap
- N
- nanosleep
- _newselect
- nfsservctl
- nice
- O
- obsolete
- oldfstat
- oldlstat
- oldolduname
- oldstat
- olduname
- openat
- open
- outb
- outb_p
- outl
- outl_p
- outsb
- outsl
- outsw
- outw
- outw_p
- P
- path_resolution
- pause
- perfmonctl
- personality
- pipe
- pivot_root
- poll
- posix_fadvise
- ppoll
- prctl
- pread
- prof
- pselect
- ptrace
- putmsg
- putpmsg
- pwrite
- Q
- query_module
- quotactl
- R
- readahead
- readdir
- read
- readlinkat
- readlink
- readv
- reboot
- recvfrom
- recv
- recvmsg
- remap_file_pages
- renameat
- rename
- request_key
- restart_syscall
- rmdir
- rtas
- rt_sigaction
- rt_sigpending
- rt_sigprocmask
- rt_sigqueueinfo
- rt_sigreturn
- rt_sigsuspend
- rt_sigtimedwait
- S
- sbrk
- sched_getaffinity
- sched_getparam
- sched_get_priority_max
- sched_get_priority_min
- sched_getscheduler
- sched_rr_get_interval
- sched_setaffinity
- sched_setparam
- sched_setscheduler
- sched_yield
- security
- select
- select_tut
- semctl
- semget
- semop
- semtimedop
- sendfile
- send
- sendmsg
- sendto
- setcontext
- setdomainname
- setegid
- seteuid
- setfsgid
- setfsuid
- setgid
- setgroups
- sethostid
- sethostname
- setitimer
- setpgid
- setpgrp
- setpriority
- setregid
- setresgid
- setresuid
- setreuid
- setrlimit
- set_robust_list
- setsid
- setsockopt
- set_thread_area
- set_tid_address
- settimeofday
- setuid
- setup
- sgetmask
- shmat
- shmctl
- shmdt
- shmget
- shmop
- shutdown
- sigaction
- sigaltstack
- signal
- sigpending
- sigprocmask
- sigqueue
- sigreturn
- sigsuspend
- sigtimedwait
- sigwaitinfo
- socketcall
- socket
- socketpair
- splice
- spu_create
- spufs
- spu_run
- ssetmask
- statfs64
- statfs
- stat
- statvfs
- stime
- stty
- swapcontext
- swapoff
- swapon
- symlinkat
- symlink
- sync_file_range
- sync
- _syscall
- syscall
- syscalls
- _sysctl
- sysctl
- sysfs
- sysinfo
- syslog
- T
- tee
- tgkill
- time
- timer_create
- timer_delete
- timer_getoverrun
- timer_gettime
- timer_settime
- times
- tkill
- truncate
- tux
- U
- umask
- umount2
- umount
- uname
- undocumented
- unimplemented
- unlinkat
- unlink
- unshare
- uselib
- ustat
- utime
- utimes
- V
- vfork
- vhangup
- vm86
- vm86old
- vmsplice
- vserver
- W
- wait3
- wait4
- wait
- waitid
- waitpid
- write
- writev
spu_run() System Call in Linux
NAME
spu_run - execute an spu context
SYNOPSIS
#include <sys/spu.h> |
int spu_run(int fd, unsigned int *npc, unsigned int *event);
DESCRIPTION
The spu_run system call is used on PowerPC machines that implement the Cell Broadband Engine Architecture in order to access Synergistic Processor Units (SPUs). It uses the fd that was returned from spu_create(2) to address a specific SPU context. When the context gets scheduled to a physical SPU, it starts execution at the instruction pointer passed in npc.
Execution of SPU code happens synchronously, meaning that spu_run does not return while the SPU is still running. If there is a need to execute SPU code in parallel with other code on either the main CPU or other SPUs, you need to create a new thread of execution first, e.g. using the pthread_create(3) call.
When spu_run returns, the current value of the SPU instruction pointer is written back to npc, so you can call spu_run again without updating the pointers.
event can be a NULL pointer or point to an extended status code that gets filled when spu_run returns. It can be one of the following constants:
Tag | Description |
---|---|
SPE_EVENT_DMA_ALIGNMENT | |
A DMA alignment error | |
SPE_EVENT_SPE_DATA_SEGMENT | |
A DMA segmentation error | |
SPE_EVENT_SPE_DATA_STORAGE | |
A DMA storage error |
RETURN VALUE
spu_run returns the value of the spu_status register or -1 to indicate an error and set errno to one of the error codes listed below. The spu_status register value contains a bit mask of status codes and optionally a 14 bit code returned from the stop-and-signal instruction on the SPU. The bit masks for the status codes are:Tag | Description |
---|---|
0x02 | SPU was stopped by stop-and-signal. |
0x04 | SPU was stopped by halt. |
0x08 | SPU is waiting for a channel. |
0x10 | SPU is in single-step mode. |
0x20 | SPU has tried to execute an invalid instruction. |
0x40 | SPU has tried to access an invalid channel. |
0x3fff0000 | |
The bits masked with this value contain the code returned from stop-and-signal. |
ERRORS
Tag | Description |
---|---|
EAGAIN or EWOULDBLOCK | |
fd is in non-blocking mode and spu_run would block. | |
EBADF | fd is not a valid file descriptor. |
EFAULT | npc is not a valid pointer or status is neither NULL nor a valid pointer. |
EINTR | A signal occured while spu_run was in progress. The npc value has been updated to the new program counter value if necessary. |
EINVAL | fd is not a file descriptor returned from spu_create(2). |
ENOMEM | Insufficient memory was available to handle a page fault resulting from an MFC direct memory access. |
ENOSYS | the functionality is not provided by the current system, because either the hardware does not provide SPUs or the spufs module is not loaded. |
NOTES
spu_run is meant to be used from libraries that implement a more abstract interface to SPUs, not to be used from regular applications.
CONFORMING TO
This call is Linux specific and only implemented by the ppc64 architecture. Programs using this system call are not portable.
BUGS
The code does not yet fully implement all features lined out here.