[Cbe-oss-dev] libspe mapping patch
Sidney Manning
sid at us.ibm.com
Sat Apr 1 05:53:18 EST 2006
spe_get_ps_area does not verify that the thread was created with the
SPE_MAP_PS flag set. This patch will cause spe_get_ps_area to fail if the
thread was not created with mapping enabled.
diff -Naur libspe-101/ps.c libspe/ps.c
--- libspe-101/ps.c 2006-02-14 08:09:24.000000000 -0600
+++ libspe/ps.c 2006-03-31 12:45:12.000000000 -0600
@@ -95,6 +95,13 @@
void *spe_get_ps_area(speid_t speid, enum ps_area area)
{
void *base_addr;
+ struct thread_store *spe = speid;
+
+ if (!(spe->flags & SPE_MAP_PS))
+ {
+ errno = EIO;
+ return MAP_FAILED;
+ }
if ( area == SPE_MSSYNC_AREA )
{
diff -Naur libspe-101/spe.c libspe/spe.c
--- libspe-101/spe.c 2006-03-10 09:27:45.000000000 -0600
+++ libspe/spe.c 2006-03-31 10:12:47.000000000 -0600
@@ -362,6 +362,7 @@
envp64.ull = (unsigned long long) (unsigned long) envp;
thread_store->group_id = gid;
+ thread_store->flags = flags;
tid64.ull = (unsigned long long) (unsigned long) thread_store;
diff -Naur libspe-101/spe.h libspe/spe.h
--- libspe-101/spe.h 2006-02-14 08:09:24.000000000 -0600
+++ libspe/spe.h 2006-03-31 12:37:23.000000000 -0600
@@ -39,6 +39,7 @@
policy, priority, affinity_mask, spe_flags,
npc, ret_status,event, ev_pipe[2];
spe_gid_t group_id;
+ unsigned int flags;
void *mem_mmap_base;
void *mfc_mmap_base;
void *cntl_mmap_base;
(See attached file: patch-mmap)
Sidney Manning -- IBM-STI Design Center Austin, TX
sid at us.ibm.com -- (512) 838-1125, TL/678-1125
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-mmap
Type: application/octet-stream
Size: 1186 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20060331/82501cbc/attachment.obj>
More information about the cbe-oss-dev
mailing list