diff options
author | eb | 2008-03-24 06:09:29 +0000 |
---|---|---|
committer | eb | 2008-03-24 06:09:29 +0000 |
commit | 28361a1bfc8f155a7b1367a234c9256b7b69da38 (patch) | |
tree | d75e71d0e87a56a542f905256688475662eee075 /gcell/src/include/memory_barrier.h | |
parent | a3ee0a2d8557477c873fb0bb43a34455944f7f58 (diff) | |
download | gnuradio-28361a1bfc8f155a7b1367a234c9256b7b69da38.tar.gz gnuradio-28361a1bfc8f155a7b1367a234c9256b7b69da38.tar.bz2 gnuradio-28361a1bfc8f155a7b1367a234c9256b7b69da38.zip |
Merged gcell, the Cell SPE scheduler and RPC mechanism into the trunk.
(eb/trunk-with-gcell r8037:8085). Expect additional tweaks, but
currently works and passes distcheck.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8086 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gcell/src/include/memory_barrier.h')
-rw-r--r-- | gcell/src/include/memory_barrier.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gcell/src/include/memory_barrier.h b/gcell/src/include/memory_barrier.h new file mode 100644 index 000000000..b373ffd91 --- /dev/null +++ b/gcell/src/include/memory_barrier.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef INCLUDED_MEMORY_BARRIER_H +#define INCLUDED_MEMORY_BARRIER_H + +/* + * powerpc memory barriers + * + * The sync instruction guarantees that all memory accesses initiated + * by this processor have been performed (with respect to all other + * mechanisms that access memory). The eieio instruction is a barrier + * providing an ordering (separately) for (a) cacheable stores and (b) + * loads and stores to non-cacheable memory (e.g. I/O devices). + * + * smp_mb() prevents loads and stores being reordered across this point. + * smp_rmb() prevents loads being reordered across this point. + * smp_wmb() prevents stores being reordered across this point. + * + * We have to use the sync instructions for smp_mb(), since lwsync + * doesn't order loads with respect to previous stores. Lwsync is + * fine for smp_rmb(), though. For smp_wmb(), we use eieio since it + * is only used to order updates to system memory. + * + * For details, see "PowerPC Virtual Environment Architecture, Book + * II". Especially Chapter 1, "Storage Model" and Chapter 3, "Storage + * Control Instructions." (site:ibm.com) + */ + +#include <ppu_intrinsics.h> + +static inline void smp_mb(void) +{ + __sync(); +} + +static inline void smp_rmb(void) +{ + __lwsync(); +} + +static inline void smp_wmb(void) +{ + __eieio(); +} + + +#endif /* INCLUDED_MEMORY_BARRIER_H */ |