2007-11-24 06:55:27 +00:00
|
|
|
.\" Copyright (c) International Business Machines Corp., 2006
|
2007-07-01 06:03:59 +00:00
|
|
|
.\"
|
epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, ioprio_set.2, signalfd.2, spu_create.2, spu_run.2, timerfd_create.2, charmap.5, locale.5, nscd.conf.5, epoll.7, spufs.7, ldconfig.8, nscd.8: s/GPLv2+_3_PARA_SW/GPLv2+_SW_3_PARA/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:29:45 +00:00
|
|
|
.\" %%%LICENSE_START(GPLv2+_SW_3_PARA)
|
2007-11-24 06:55:27 +00:00
|
|
|
.\" This program is free software; you can redistribute it and/or
|
2007-07-01 06:03:59 +00:00
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" This program is distributed in the hope that it will be useful,
|
2007-11-24 06:55:27 +00:00
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
2007-07-01 06:03:59 +00:00
|
|
|
.\" the GNU General Public License for more details.
|
|
|
|
.\"
|
epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, ioprio_set.2, signalfd.2, spu_create.2, spu_run.2, timerfd_create.2, epoll.7, spufs.7: Global fix: Update info in source comments on where to get a copy of the GPL
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:28:52 +00:00
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, see
|
|
|
|
.\" <http://www.gnu.org/licenses/>.
|
epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, fallocate.2, futex.2, getcpu.2, getitimer.2, ioctl_list.2, ioprio_set.2, migrate_pages.2, move_pages.2, pciconfig_read.2, sendfile.2, setns.2, signalfd.2, spu_create.2, spu_run.2, sysinfo.2, timerfd_create.2, backtrace.3, cmsg.3, error.3, getpt.3, getrpcent.3, getrpcport.3, getsubopt.3, offsetof.3, program_invocation_name.3, rpc.3, rpmatch.3, rtnetlink.3, xdr.3, cciss.4, hpsa.4, pts.4, charmap.5, dir_colors.5, elf.5, gai.conf.5, locale.5, nscd.conf.5, nss.5, resolv.conf.5, rpc.5, arp.7, cpuset.7, ddp.7, epoll.7, fifo.7, futex.7, icmp.7, ip.7, ipv6.7, mailaddr.7, netdevice.7, packet.7, raw.7, regex.7, rtnetlink.7, socket.7, spufs.7, tcp.7, udp.7, unix.7, x25.7, ldconfig.8, nscd.8: Global fix: s/END_LICENSE/LICENSE_END/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-12 09:26:07 +00:00
|
|
|
.\" %%%LICENSE_END
|
2007-07-01 06:03:59 +00:00
|
|
|
.\"
|
|
|
|
.\" HISTORY:
|
|
|
|
.\" 2005-09-28, created by Arnd Bergmann <arndb@de.ibm.com>
|
|
|
|
.\" 2006-06-16, revised by Eduardo M. Fleury <efleury@br.ibm.com>
|
|
|
|
.\" 2007-07-10, some polishing by mtk
|
2007-11-24 06:55:27 +00:00
|
|
|
.\" 2007-09-28, updates for newer kernels, added example
|
|
|
|
.\" by Jeremy Kerr <jk@ozlabs.org>
|
2007-07-01 06:03:59 +00:00
|
|
|
.\"
|
capget.2, futex.2, sched_setscheduler.2, spu_create.2, spu_run.2, vfork.2, getnameinfo.3, netlink.3, cciss.4, console_codes.4, dsp56k.4, hpsa.4, sk98lin.4, filesystems.5, protocols.5, aio.7, capabilities.7, charsets.7, feature_test_macros.7, futex.7, hier.7, iso_8859-16.7, iso_8859-2.7, koi8-r.7, libc.7, man.7, netlink.7, numa.7, standards.7, unicode.7, units.7, uri.7, x25.7: Global fix: use UR macro where applicable
The syntax .UR http://example.com paired with .UE will create
links which one can interact, if the pager allows that. One
way to see the effect is ask the man(1) command to use browser
display, e.g.:
man -H man7/uri.7
("\:" is optional groff syntax to permit hyphenless line breaks.)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-08-13 08:02:36 +00:00
|
|
|
.TH SPU_RUN 2 2012-08-05 Linux "Linux Programmer's Manual"
|
2007-07-01 06:03:59 +00:00
|
|
|
.SH NAME
|
2007-12-29 17:42:38 +00:00
|
|
|
spu_run \- execute an SPU context
|
2007-07-01 06:03:59 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <sys/spu.h>
|
|
|
|
|
|
|
|
.BI "int spu_run(int " fd ", unsigned int *" npc \
|
|
|
|
", unsigned int *" event ");"
|
|
|
|
.fi
|
get_robust_list.2, get_thread_area.2, getcpu.2, getdents.2, gettid.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioprio_set.2, kexec_load.2, llseek.2, modify_ldt.2, mq_getsetattr.2, pivot_root.2, readdir.2, rt_sigqueueinfo.2, set_thread_area.2, sgetmask.2, spu_create.2, spu_run.2, subpage_prot.2, sysctl.2, tkill.2: Add note to SYNOPSIS that there is no glibc wrapper for system call
Reduce the chance that the reader may be misled into thinking
that there is a wrapper function for this system call by noting
explicitly in the SYNOPSIS that there is no glibc wrapper and
pointing the reader to NOTES for further details.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-07-13 06:48:20 +00:00
|
|
|
|
|
|
|
.IR Note :
|
|
|
|
There is no glibc wrapper for this system call; see NOTES.
|
2007-07-01 06:03:59 +00:00
|
|
|
.SH DESCRIPTION
|
2007-07-08 12:39:24 +00:00
|
|
|
The
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_run ()
|
2007-07-08 12:39:24 +00:00
|
|
|
system call is used on PowerPC machines that implement the
|
|
|
|
Cell Broadband Engine Architecture in order to access Synergistic
|
2007-07-01 06:03:59 +00:00
|
|
|
Processor Units (SPUs).
|
|
|
|
The
|
|
|
|
.I fd
|
2007-07-08 12:39:24 +00:00
|
|
|
argument is a file descriptor returned by
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_create (2)
|
2007-11-24 06:55:27 +00:00
|
|
|
that refers to a specific SPU context.
|
|
|
|
When the context gets scheduled to a physical SPU,
|
|
|
|
it starts execution at the instruction pointer passed in
|
2007-07-01 06:03:59 +00:00
|
|
|
.IR npc .
|
|
|
|
|
2007-07-08 12:39:24 +00:00
|
|
|
Execution of SPU code happens synchronously, meaning that
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_run ()
|
2007-11-24 06:55:27 +00:00
|
|
|
blocks while the SPU is still running.
|
2007-07-01 06:03:59 +00:00
|
|
|
If there is a need
|
2007-07-08 12:39:24 +00:00
|
|
|
to execute SPU code in parallel with other code on either the
|
2007-07-01 06:03:59 +00:00
|
|
|
main CPU or other SPUs, a new thread of execution must be created
|
2007-11-24 06:55:27 +00:00
|
|
|
first (e.g., using
|
|
|
|
.BR pthread_create (3)).
|
2007-07-01 06:03:59 +00:00
|
|
|
|
|
|
|
When
|
|
|
|
.BR spu_run ()
|
2007-11-24 06:55:27 +00:00
|
|
|
returns, the current value of the SPU program counter is written to
|
2007-07-01 06:03:59 +00:00
|
|
|
.IR npc ,
|
2007-11-24 06:55:27 +00:00
|
|
|
so successive calls to
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_run ()
|
2007-11-24 06:55:27 +00:00
|
|
|
can use the same
|
|
|
|
.I npc
|
|
|
|
pointer.
|
2007-07-01 06:03:59 +00:00
|
|
|
|
2007-11-24 06:55:27 +00:00
|
|
|
The
|
2007-07-01 06:03:59 +00:00
|
|
|
.I event
|
2007-11-24 06:55:27 +00:00
|
|
|
argument provides a buffer for an extended status code.
|
|
|
|
If the SPU
|
|
|
|
context was created with the
|
|
|
|
.B SPU_CREATE_EVENTS_ENABLED
|
|
|
|
flag, then this buffer is populated by the Linux kernel before
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_run ()
|
2007-11-24 06:55:27 +00:00
|
|
|
returns.
|
|
|
|
|
|
|
|
The status code may be one (or more) of the following constants:
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B SPE_EVENT_DMA_ALIGNMENT
|
2007-11-24 06:55:27 +00:00
|
|
|
A DMA alignment error occurred.
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B SPE_EVENT_INVALID_DMA
|
2007-11-24 06:55:27 +00:00
|
|
|
An invalid MFC DMA command was attempted.
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B SPE_EVENT_SPE_DATA_STORAGE
|
2007-11-24 06:55:27 +00:00
|
|
|
A DMA storage error occurred.
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B SPE_EVENT_SPE_ERROR
|
2007-11-24 06:55:27 +00:00
|
|
|
An illegal instruction was executed.
|
2007-07-01 06:03:59 +00:00
|
|
|
.PP
|
2007-11-24 06:55:27 +00:00
|
|
|
NULL
|
|
|
|
is a valid value for the
|
2007-07-01 06:03:59 +00:00
|
|
|
.I event
|
2007-11-24 06:55:27 +00:00
|
|
|
argument.
|
|
|
|
In this case, the events will not be reported to the calling process.
|
2007-07-01 06:03:59 +00:00
|
|
|
.SH RETURN VALUE
|
2007-11-24 06:55:27 +00:00
|
|
|
On success,
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_run ()
|
|
|
|
returns the value of the
|
|
|
|
.I spu_status
|
|
|
|
register.
|
2014-02-04 13:38:58 +00:00
|
|
|
On error, it returns \-1 and sets
|
2007-07-01 06:03:59 +00:00
|
|
|
.I errno
|
|
|
|
to one of the error codes listed below.
|
2007-11-24 06:55:27 +00:00
|
|
|
|
2007-07-08 12:39:24 +00:00
|
|
|
The
|
2007-07-01 06:03:59 +00:00
|
|
|
.I spu_status
|
|
|
|
register value is a bit mask of status codes and
|
2007-11-24 06:55:27 +00:00
|
|
|
optionally a 14-bit code returned from the
|
|
|
|
.BR stop-and-signal
|
2007-07-01 06:03:59 +00:00
|
|
|
instruction on the SPU.
|
|
|
|
The bit masks for the status codes
|
|
|
|
are:
|
|
|
|
.TP
|
|
|
|
.B 0x02
|
2007-11-24 06:55:27 +00:00
|
|
|
SPU was stopped by a
|
|
|
|
.BR stop-and-signal
|
|
|
|
instruction.
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B 0x04
|
2007-11-24 06:55:27 +00:00
|
|
|
SPU was stopped by a
|
|
|
|
.BR halt
|
|
|
|
instruction.
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B 0x08
|
|
|
|
SPU is waiting for a channel.
|
|
|
|
.TP
|
|
|
|
.B 0x10
|
|
|
|
SPU is in single-step mode.
|
|
|
|
.TP
|
|
|
|
.B 0x20
|
|
|
|
SPU has tried to execute an invalid instruction.
|
|
|
|
.TP
|
|
|
|
.B 0x40
|
|
|
|
SPU has tried to access an invalid channel.
|
2007-11-24 06:55:27 +00:00
|
|
|
.TP
|
|
|
|
.B 0x3fff0000
|
|
|
|
The bits masked with this value contain the code returned from a
|
|
|
|
.BR stop-and-signal
|
|
|
|
instruction.
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
These bits are valid only if the 0x02 bit is set.
|
2007-07-01 06:03:59 +00:00
|
|
|
.PP
|
|
|
|
If
|
|
|
|
.BR spu_run ()
|
|
|
|
has not returned an error, one or more bits among the lower eight
|
|
|
|
ones are always set.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EBADF
|
|
|
|
.I fd
|
|
|
|
is not a valid file descriptor.
|
|
|
|
.TP
|
|
|
|
.B EFAULT
|
|
|
|
.I npc
|
2007-11-24 06:55:27 +00:00
|
|
|
is not a valid pointer, or
|
|
|
|
.I event
|
|
|
|
is non-NULL and an invalid pointer.
|
2007-07-01 06:03:59 +00:00
|
|
|
.TP
|
|
|
|
.B EINTR
|
|
|
|
A signal occurred while
|
|
|
|
.BR spu_run ()
|
2008-07-07 05:24:15 +00:00
|
|
|
was in progress; see
|
|
|
|
.BR signal (7).
|
2007-07-01 06:03:59 +00:00
|
|
|
The
|
|
|
|
.I npc
|
|
|
|
value has been updated to the new program counter value if
|
|
|
|
necessary.
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
.I fd
|
2007-11-24 06:55:27 +00:00
|
|
|
is not a valid file descriptor returned from
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spu_create (2).
|
|
|
|
.TP
|
|
|
|
.B ENOMEM
|
|
|
|
There was not enough memory available to handle a page fault
|
|
|
|
resulting from a Memory Flow Controller (MFC) direct memory access.
|
|
|
|
.TP
|
|
|
|
.B 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.
|
|
|
|
.SH VERSIONS
|
|
|
|
The
|
2007-11-24 10:10:39 +00:00
|
|
|
.BR spu_run ()
|
2007-07-01 06:03:59 +00:00
|
|
|
system call was added to Linux in kernel 2.6.16.
|
|
|
|
.SH CONFORMING TO
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
This call is Linux-specific and implemented only by the PowerPC
|
2007-07-01 06:03:59 +00:00
|
|
|
architecture.
|
|
|
|
Programs using this system call are not portable.
|
|
|
|
.SH NOTES
|
|
|
|
Glibc does not provide a wrapper for this system call; call it using
|
|
|
|
.BR syscall (2).
|
|
|
|
Note however, that
|
|
|
|
.BR spu_run ()
|
|
|
|
is meant to be used from libraries that implement a more abstract
|
|
|
|
interface to SPUs, not to be used from regular applications.
|
2007-07-08 12:39:24 +00:00
|
|
|
See
|
capget.2, futex.2, sched_setscheduler.2, spu_create.2, spu_run.2, vfork.2, getnameinfo.3, netlink.3, cciss.4, console_codes.4, dsp56k.4, hpsa.4, sk98lin.4, filesystems.5, protocols.5, aio.7, capabilities.7, charsets.7, feature_test_macros.7, futex.7, hier.7, iso_8859-16.7, iso_8859-2.7, koi8-r.7, libc.7, man.7, netlink.7, numa.7, standards.7, unicode.7, units.7, uri.7, x25.7: Global fix: use UR macro where applicable
The syntax .UR http://example.com paired with .UE will create
links which one can interact, if the pager allows that. One
way to see the effect is ask the man(1) command to use browser
display, e.g.:
man -H man7/uri.7
("\:" is optional groff syntax to permit hyphenless line breaks.)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-08-13 08:02:36 +00:00
|
|
|
.UR http://www.bsc.es\:/projects\:/deepcomputing\:/linuxoncell/
|
|
|
|
.UE
|
2007-07-01 06:03:59 +00:00
|
|
|
for the recommended libraries.
|
2007-11-24 06:55:27 +00:00
|
|
|
.SH EXAMPLE
|
|
|
|
The following is an example of running a simple, one-instruction SPU
|
|
|
|
program with the
|
|
|
|
.BR spu_run ()
|
|
|
|
system call.
|
|
|
|
|
|
|
|
.nf
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#define handle_error(msg) \\
|
|
|
|
do { perror(msg); exit(EXIT_FAILURE); } while (0)
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
int context, fd, spu_status;
|
|
|
|
uint32_t instruction, npc;
|
|
|
|
|
|
|
|
context = spu_create("/spu/example\-context", 0, 0755);
|
fallocate.2, kexec_load.2, poll.2, spu_run.2, atan2.3, cbrt.3, clock_getcpuclockid.3, end.3, frexp.3, getgrouplist.3, getifaddrs.3, matherr.3, modf.3, pow.3, pthread_getattr_np.3, pthread_getcpuclockid.3, sched_getcpu.3, tgamma.3, mouse.4, proc.5, feature_test_macros.7, spufs.7: Global fix: properly escape minus sign
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2011-09-10 01:57:53 +00:00
|
|
|
if (context == \-1)
|
2007-11-24 06:55:27 +00:00
|
|
|
handle_error("spu_create");
|
|
|
|
|
2008-06-09 15:49:35 +00:00
|
|
|
/* write a \(aqstop 0x1234\(aq instruction to the SPU\(aqs
|
2007-11-24 06:55:27 +00:00
|
|
|
* local store memory
|
|
|
|
*/
|
|
|
|
instruction = 0x00001234;
|
|
|
|
|
|
|
|
fd = open("/spu/example\-context/mem", O_RDWR);
|
fallocate.2, kexec_load.2, poll.2, spu_run.2, atan2.3, cbrt.3, clock_getcpuclockid.3, end.3, frexp.3, getgrouplist.3, getifaddrs.3, matherr.3, modf.3, pow.3, pthread_getattr_np.3, pthread_getcpuclockid.3, sched_getcpu.3, tgamma.3, mouse.4, proc.5, feature_test_macros.7, spufs.7: Global fix: properly escape minus sign
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2011-09-10 01:57:53 +00:00
|
|
|
if (fd == \-1)
|
2007-11-24 06:55:27 +00:00
|
|
|
handle_error("open");
|
|
|
|
write(fd, &instruction, sizeof(instruction));
|
|
|
|
|
|
|
|
/* set npc to the starting instruction address of the
|
|
|
|
* SPU program. Since we wrote the instruction at the
|
|
|
|
* start of the mem file, the entry point will be 0x0
|
|
|
|
*/
|
|
|
|
npc = 0;
|
|
|
|
|
|
|
|
spu_status = spu_run(context, &npc, NULL);
|
fallocate.2, kexec_load.2, poll.2, spu_run.2, atan2.3, cbrt.3, clock_getcpuclockid.3, end.3, frexp.3, getgrouplist.3, getifaddrs.3, matherr.3, modf.3, pow.3, pthread_getattr_np.3, pthread_getcpuclockid.3, sched_getcpu.3, tgamma.3, mouse.4, proc.5, feature_test_macros.7, spufs.7: Global fix: properly escape minus sign
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2011-09-10 01:57:53 +00:00
|
|
|
if (spu_status == \-1)
|
2007-11-24 06:55:27 +00:00
|
|
|
handle_error("open");
|
|
|
|
|
|
|
|
/* we should see a status code of 0x1234002:
|
|
|
|
* 0x00000002 (spu was stopped due to stop\-and\-signal)
|
|
|
|
* | 0x12340000 (the stop\-and\-signal code)
|
|
|
|
*/
|
|
|
|
printf("SPU Status: 0x%08x\\n", spu_status);
|
|
|
|
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.\" .SH AUTHORS
|
|
|
|
.\" Arnd Bergmann <arndb@de.ibm.com>, Jeremy Kerr <jk@ozlabs.org>
|
2007-07-01 06:03:59 +00:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR close (2),
|
|
|
|
.BR spu_create (2),
|
2007-11-24 06:55:27 +00:00
|
|
|
.BR capabilities (7),
|
2007-07-01 06:03:59 +00:00
|
|
|
.BR spufs (7)
|