libspe for 2.6.13 spufs
Arnd Bergmann
arnd at arndb.de
Wed Oct 12 03:18:13 EST 2005
On Freedag 30 September 2005 16:28, Arnd Bergmann wrote:
> As a companion to the spufs release posted yesterday, this is the
> user space libspe library from Dirk Herrendoerfer, together with
> the extracted interface documentation.
This is a small update to the libspe version posted previously, the
changes are:
- Add a proper .spec file for building rpms (the one used on www.bsc.es
was rather broken)
- Include the doxygen source for building the documentation.
- rename spe.h to libspe.h in order to prevent conflicts with the file
of the same name provided by some gcc versions.
- fix the usage of spe_program_handle_t.
Arnd <><
diff -urN -x CVS libspe-0.9/Doxyfile libspe-0.9.1/Doxyfile
--- libspe-0.9/Doxyfile 1970-01-01 01:00:00.000000000 +0100
+++ libspe-0.9.1/Doxyfile 2005-09-29 19:35:03.000000000 +0200
@@ -0,0 +1,267 @@
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = libspe
+PROJECT_NUMBER = V1.0
+OUTPUT_DIRECTORY = doc/
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = ./
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = NO
+GENERATE_TESTLIST = NO
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = NO
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ./
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.php \
+ *.php3 \
+ *.inc \
+ *.m \
+ *.mm \
+ *.dox \
+ *.C \
+ *.CC \
+ *.C++ \
+ *.II \
+ *.I++ \
+ *.H \
+ *.HH \
+ *.H++ \
+ *.CS \
+ *.PHP \
+ *.PHP3 \
+ *.M \
+ *.MM
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+VERBATIM_HEADERS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = YES
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
diff -urN -x CVS libspe-0.9/Makefile libspe-0.9.1/Makefile
--- libspe-0.9/Makefile 2005-09-30 15:32:18.000000000 +0200
+++ libspe-0.9.1/Makefile 2005-10-11 16:08:31.000000000 +0200
@@ -73,18 +73,18 @@
sed -e "s%@BINDIR@%${bindir}%g" <$< >$@
chmod +x $@
-install: spe.h libspe.so elfspe elfspe-register
+install: mfc.h libspe.h libspe.so elfspe elfspe-register
$(INSTALL_DATA) mfc.h \
$(DESTDIR)$(includedir)/mfc.h
- $(INSTALL_DATA) spe.h \
- $(DESTDIR)$(includedir)/spe.h
+ $(INSTALL_DATA) libspe.h \
+ $(DESTDIR)$(includedir)/libspe.h
$(INSTALL_PROGRAM) libspe.so \
$(DESTDIR)$(libdir)/$(libspe_SO)
$(INSTALL_PROGRAM) libspe.a \
$(DESTDIR)$(libdir)/libspe.a
- ln -sf $(DESTDIR)$(libdir)/$(libspe_SO) \
+ ln -sf $(libspe_SO) \
$(DESTDIR)$(libdir)/$(libspe_SONAME)
- ln -sf $(DESTDIR)$(libdir)/$(libspe_SO) \
+ ln -sf $(libspe_SO) \
$(DESTDIR)$(libdir)/libspe.so
$(INSTALL_PROGRAM) elfspe \
$(DESTDIR)$(bindir)/elfspe
@@ -98,5 +98,5 @@
$(CTAGS) -R .
clean:
- rm -f libspe.so $(libspe_OBJS) *~ tags elfspe elfspe-register
+ rm -f libspe.a libspe.so $(libspe_OBJS) *~ tags elfspe elfspe-register
make -C tests clean
diff -urN -x CVS libspe-0.9/elf_loader.c libspe-0.9.1/elf_loader.c
--- libspe-0.9/elf_loader.c 2005-09-30 15:30:18.000000000 +0200
+++ libspe-0.9.1/elf_loader.c 2005-10-11 16:08:31.000000000 +0200
@@ -26,8 +26,9 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include "elf_loader.h"
+#include "libspe.h"
#include "spe.h"
+#include "elf_loader.h"
#define __PRINTF(fmt, args...) { fprintf(stderr,fmt , ## args); }
#ifdef DEBUG
@@ -56,7 +57,7 @@
int num_load_seg = 0;
void *elf_start;
- if (handle->toe_struct)
+ if (handle->toe_shadow)
{
printf("CSOF type image loading not supported.");
errno = EINVAL;
@@ -64,7 +65,7 @@
}
- elf_start = handle->start;
+ elf_start = handle->elf_image;
DEBUG_PRINTF ("load_spe_elf(%p, %p)\n", elf_start, ld_buffer);
ehdr = (Elf32_Ehdr *) elf_start;
diff -urN -x CVS libspe-0.9/elfspe.c libspe-0.9.1/elfspe.c
--- libspe-0.9/elfspe.c 2005-09-30 15:30:18.000000000 +0200
+++ libspe-0.9.1/elfspe.c 2005-10-11 16:08:31.000000000 +0200
@@ -28,7 +28,8 @@
#include <fcntl.h>
#include <unistd.h>
-#include <spe.h>
+#include "libspe.h"
+#include "spe.h"
static void *spe = NULL;
@@ -37,27 +38,6 @@
#define LS_ADDR_MASK (LS_SIZE - 1)
#endif /* LS_SIZE */
-static void *
-mmap_file (const char *filename, off_t size, int rw)
-{
- int flags = rw? O_RDWR : O_RDONLY;
- int prot = rw? (PROT_READ | PROT_WRITE) : PROT_READ;
- size_t ps = getpagesize ();
-
- void *addr;
- int fd;
-
- if ((fd = open (filename, flags)) < 0)
- return NULL;
-
- addr = mmap (NULL, (size + ps - 1) & ~(ps - 1), prot, MAP_SHARED, fd, 0);
- if (addr == MAP_FAILED)
- return NULL;
-
- close (fd);
-
- return addr;
-}
static void handler (int signr ) __attribute__ ((noreturn));
static void
@@ -157,10 +137,9 @@
int
main (int argc, char **argv)
{
+ spe_program_handle_t *handle;
spe_gid_t gid;
struct spe_regs params;
- struct stat st;
- void *file;
int rc;
signal (SIGSEGV, handler);
@@ -177,14 +156,8 @@
exit (1);
}
- if (stat (argv[1], &st) < 0)
- {
- perror (argv[1]);
- exit (1);
- }
-
- file = mmap_file (argv[1], st.st_size, 0);
- if (!file)
+ handle = spe_open_image (argv[1]);
+ if (!handle)
{
perror (argv[1]);
exit (1);
@@ -203,7 +176,7 @@
exit (1);
}
- spe = spe_setup (gid, file, ¶ms, NULL, SPE_USER_REGS);
+ spe = spe_setup (gid, handle, ¶ms, NULL, SPE_USER_REGS);
if (!spe)
{
perror ("spe_setup");
@@ -213,6 +186,8 @@
rc = do_spe_run (spe);
spe_cleanup (spe);
+ spe_close_image (handle);
+
return rc & 0xff;
}
diff -urN -x CVS libspe-0.9/libspe.h libspe-0.9.1/libspe.h
--- libspe-0.9/libspe.h 1970-01-01 01:00:00.000000000 +0100
+++ libspe-0.9.1/libspe.h 2005-10-11 10:50:09.000000000 +0200
@@ -0,0 +1,74 @@
+/*
+ * libspe - A wrapper library to adapt the JSRE SPE usage model to SPUFS
+ * Copyright (C) 2005 IBM Corp.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _libspe_h_
+#define _libspe_h_
+
+typedef void *speid_t;
+typedef void *spe_gid_t;
+
+/* spe_program_handle per CESOF spec
+ */
+typedef struct spe_program_handle {
+ unsigned int handle_size;
+ void *elf_image;
+ void *toe_shadow;
+} spe_program_handle_t;
+
+/* Flags for spe_create_thread
+ */
+
+#define SPE_PTRACE_ME 0x0001 /* Allow debugger to attach */
+#define SPE_USER_REGS 0x0002 /* 128b user data for r3-5. */
+
+#define SPE_CFG_SIGNOTIFY1_OR 0x00000010
+#define SPE_CFG_SIGNOTIFY2_OR 0x00000020
+
+/* Flags for
+ * */
+#define SPE_MAX_THREADS_PER_GROUP 16 /* Sanity value - will be removed in the future */
+
+/* APIs for SPE threads.
+ */
+
+extern spe_gid_t spe_create_group (int policy, int priority, int spe_events);
+extern int spe_group_max (spe_gid_t spe_gid);
+
+extern speid_t spe_create_thread (spe_gid_t gid, spe_program_handle_t *handle,
+ void *argp, void *envp,
+ unsigned long mask, int flags);
+
+extern int spe_wait (speid_t speid, int *status, int options);
+
+extern int spe_kill (speid_t speid, int sig);
+extern int spe_get_priority(spe_gid_t gid);
+extern int spe_set_priority(spe_gid_t gid, int priority);
+extern int spe_get_policy(spe_gid_t gid);
+extern spe_gid_t spe_get_group (speid_t speid);
+extern int spe_group_defaults(int policy, int priority, int spe_events);
+
+extern void *spe_get_ls(speid_t speid);
+extern void *spe_get_ps(speid_t speid);
+
+/* APIs for loading SPE images
+ */
+extern spe_program_handle_t *spe_open_image(const char *filename);
+extern int spe_close_image(spe_program_handle_t *program_handle);
+
+#endif
diff -urN -x CVS libspe-0.9/libspe.spec libspe-0.9.1/libspe.spec
--- libspe-0.9/libspe.spec 1970-01-01 01:00:00.000000000 +0100
+++ libspe-0.9.1/libspe.spec 2005-10-11 19:09:47.000000000 +0200
@@ -0,0 +1,48 @@
+Name: libspe
+Version: 0.9.1
+Release: 1
+License: LGPL
+Group: System Environment/Base
+Source: %{name}-%{version}.tar.gz
+Buildroot: %{_tmppath}/libspe
+Summary: SPE Runtime Management Library
+
+%package -n libspe-devel
+Summary: SPE Runtime Management Library
+Group: Development/Libraries
+
+%description
+SPE Runtime Management Library for the
+Cell Broadband Engine Architecture.
+
+%description -n libspe-devel
+Header and object files for SPE Runtime
+Management Library.
+
+%prep
+
+%setup
+
+%build
+make prefix=%{_prefix} libdir=%{_libdir}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+mkdir -p $RPM_BUILD_ROOT/%{_bindir}
+mkdir -p $RPM_BUILD_ROOT/%{_libdir}
+mkdir -p $RPM_BUILD_ROOT/%{_includedir}
+%makeinstall
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%{_bindir}
+%{_libdir}/*.so.*
+
+%files -n libspe-devel
+%{_libdir}/*.so
+%{_libdir}/*.a
+%{_includedir}
diff -urN -x CVS libspe-0.9/main.dox libspe-0.9.1/main.dox
--- libspe-0.9/main.dox 1970-01-01 01:00:00.000000000 +0100
+++ libspe-0.9.1/main.dox 2005-09-30 15:57:01.000000000 +0200
@@ -0,0 +1,22 @@
+/**
+ * \mainpage SPE Managemenent Library (libspe)
+ * \author D.Herrendoerfer (d.herrendoerfer at de.ibm.com)
+ * \section About
+ * The SPE Management Library consists of PPE interfaces used to manage SPEs.
+ * These interfaces are similar to those used to manage regular threads and
+ * processes in a POSIX compliant operating system.
+ *
+ * Library name:
+ *
+ * libspe
+ *
+ * Header file:
+ *
+ * <spe.h>
+ *
+ * <mfc.h>
+ *
+ * \section Misc
+ * This library presents work-in-progress. Some functions are provided for
+ * completeness of the programming model only.
+ */
diff -urN -x CVS libspe-0.9/spe.c libspe-0.9.1/spe.c
--- libspe-0.9/spe.c 2005-09-30 15:39:19.000000000 +0200
+++ libspe-0.9.1/spe.c 2005-10-11 16:08:31.000000000 +0200
@@ -33,9 +33,10 @@
#include <sys/types.h>
#include <sys/mman.h>
-#include <spe.h>
-#include <elf_loader.h>
-#include <mfc.h>
+#include "libspe.h"
+#include "mfc.h"
+#include "spe.h"
+#include "elf_loader.h"
#include <spe_exec.h>
#define __PRINTF(fmt, args...) { fprintf(stderr,fmt , ## args); }
@@ -482,6 +483,11 @@
/* APIs for loading SPE-ELF images & files.
*/
+struct image_handle {
+ spe_program_handle_t speh;
+ unsigned int map_size;
+};
+
/**
* \brief spe_open_image - maps spe executable int system memory.
*
@@ -492,33 +498,48 @@
* \returns handle of the program
* \retval NULL failure, see \c errno for more info
*/
-spe_program_handle_t
+spe_program_handle_t
*spe_open_image(const char *filename)
{
- spe_program_handle_t *ret;
- int binfd, f_stat;
+ /* allocate an extra integer in the spe handle to keep the mapped size information */
+ struct image_handle *ret;
+ int binfd = -1, f_stat;
struct stat statbuf;
-
- ret=malloc(sizeof(spe_program_handle_t));
+ size_t ps = getpagesize ();
+
+ ret = malloc(sizeof(struct image_handle));
if (!ret)
return NULL;
+ ret->speh.handle_size = sizeof(spe_program_handle_t);
+ ret->speh.toe_shadow = NULL;
+
binfd = open(filename, O_RDONLY);
if (binfd < 0)
- return NULL;
-
+ goto ret_err;
+
f_stat = fstat(binfd, &statbuf);
if (f_stat < 0)
- return NULL;
-
- ret->toe_struct = NULL;
- ret->prog_size = statbuf.st_size;
+ goto ret_err;
- ret->start = mmap(NULL, statbuf.st_size, PROT_READ , MAP_SHARED, binfd, 0);
- if (ret->start == MAP_FAILED)
- return NULL;
+ /* now store the size at the extra allocated space */
+ ret->map_size = (statbuf.st_size + ps - 1) & ~(ps - 1);
- return ret;
+ ret->speh.elf_image = mmap(NULL, ret->map_size, PROT_READ, MAP_SHARED, binfd, 0);
+ if (ret->speh.elf_image == MAP_FAILED)
+ goto ret_err;
+
+ /* ok */
+ close(binfd);
+ return (spe_program_handle_t *)ret;
+
+ /* err & cleanup */
+ret_err:
+ if (binfd >= 0)
+ close(binfd);
+
+ free(ret);
+ return NULL;
}
/**
@@ -530,15 +551,15 @@
* \retval zero on success
* \retval -1 on failure, and sets \c errno.
*/
-int
-spe_close_image(spe_program_handle_t *program_handle)
+int
+spe_close_image(spe_program_handle_t *handle)
{
- void *start = program_handle->start;
- unsigned int prog_size = program_handle->prog_size;
-
- free(program_handle);
+ void *elf_start = handle->elf_image;
+ unsigned int prog_size = ((struct image_handle*)handle)->map_size;
+
+ free(handle);
- return munmap(start, prog_size);
+ return munmap(elf_start, prog_size);
}
static void *
@@ -704,6 +725,7 @@
* @param speid spe store structure
*
* \returns address of local store.
+ * \retval NULL on failure.
*/
void
*spe_get_ls (speid_t speid)
diff -urN -x CVS libspe-0.9/spe.h libspe-0.9.1/spe.h
--- libspe-0.9/spe.h 2005-09-30 15:32:18.000000000 +0200
+++ libspe-0.9.1/spe.h 2005-10-11 16:08:31.000000000 +0200
@@ -20,28 +20,6 @@
#ifndef _spe_h_
#define _spe_h_
-typedef void *speid_t;
-typedef void *spe_gid_t;
-
-typedef struct {
- void *start;
- void *toe_struct;
- unsigned int prog_size;
-} spe_program_handle_t;
-
-/* Flags for spe_create_thread
- */
-
-#define SPE_PTRACE_ME 0x0001 /* Allow debugger to attach */
-#define SPE_USER_REGS 0x0002 /* 128b user data for r3-5. */
-
-#define SPE_CFG_SIGNOTIFY1_OR 0x00000010
-#define SPE_CFG_SIGNOTIFY2_OR 0x00000020
-
-/* Flags for
- * */
-#define SPE_MAX_THREADS_PER_GROUP 16 /* Sanity value - will be removed in the future */
-
/* Low-level SPE execution API.
*/
extern void *spe_gid_setup(int policy, int priority, int use_events);
@@ -50,31 +28,4 @@
extern int do_spe_run (void *spe);
extern unsigned int set_npc (void *spe, unsigned int npc);
-/* APIs for SPE threads.
- */
-
-extern spe_gid_t spe_create_group (int policy, int priority, int spe_events);
-extern int spe_group_max (spe_gid_t spe_gid);
-
-extern speid_t spe_create_thread (spe_gid_t gid, spe_program_handle_t *handle,
- void *argp, void *envp,
- unsigned long mask, int flags);
-
-extern int spe_wait (speid_t speid, int *status, int options);
-
-extern int spe_kill (speid_t speid, int sig);
-extern int spe_get_priority(spe_gid_t gid);
-extern int spe_set_priority(spe_gid_t gid, int priority);
-extern int spe_get_policy(spe_gid_t gid);
-extern spe_gid_t spe_get_group (speid_t speid);
-extern int spe_group_defaults(int policy, int priority, int spe_events);
-
-extern void *spe_get_ls(speid_t speid);
-extern void *spe_get_ps(speid_t speid);
-
-/* APIs for loading SPE images
- */
-extern spe_program_handle_t *spe_open_image(const char *filename);
-extern int spe_close_image(spe_program_handle_t *program_handle);
-
#endif
diff -urN -x CVS libspe-0.9/tests/start-stop/ppe-start-stop.c libspe-0.9.1/tests/start-stop/ppe-start-stop.c
--- libspe-0.9/tests/start-stop/ppe-start-stop.c 2005-09-28 14:31:01.000000000 +0200
+++ libspe-0.9.1/tests/start-stop/ppe-start-stop.c 2005-10-11 16:08:31.000000000 +0200
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <spe.h>
+#include <libspe.h>
int main(int argc, char* argv[])
More information about the Linuxppc64-dev
mailing list