libspe2
0.9a
|
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/spu.h>
#include <sys/stat.h>
#include <unistd.h>
#include "create.h"
#include "spebase.h"
Go to the source code of this file.
Data Structures | |
struct | fd_attr |
Functions | |
void | _base_spe_context_lock (spe_context_ptr_t spe, enum fd_name fdesc) |
void | _base_spe_context_unlock (spe_context_ptr_t spe, enum fd_name fdesc) |
int | _base_spe_open_if_closed (struct spe_context *spe, enum fd_name fdesc, int locked) |
void | _base_spe_close_if_open (struct spe_context *spe, enum fd_name fdesc) |
spe_context_ptr_t | _base_spe_context_create (unsigned int flags, spe_gang_context_ptr_t gctx, spe_context_ptr_t aff_spe) |
spe_gang_context_ptr_t | _base_spe_gang_context_create (unsigned int flags) |
int | _base_spe_context_destroy (spe_context_ptr_t spe) |
int | _base_spe_gang_context_destroy (spe_gang_context_ptr_t gctx) |
void _base_spe_close_if_open | ( | struct spe_context * | spe, |
enum fd_name | fdesc | ||
) |
Definition at line 125 of file create.c.
References _base_spe_context_lock(), _base_spe_context_unlock(), spe_context::base_private, spe_context_base_priv::spe_fds_array, and spe_context_base_priv::spe_fds_refcount.
Referenced by __base_spe_event_source_release(), and _base_spe_signal_write().
spe_context_ptr_t _base_spe_context_create | ( | unsigned int | flags, |
spe_gang_context_ptr_t | gctx, | ||
spe_context_ptr_t | aff_spe | ||
) |
_base_spe_context_create creates a single SPE context, i.e., the corresponding directory is created in SPUFS either as a subdirectory of a gang or individually (maybe this is best considered a gang of one)
flags | |
gctx | specify NULL if not belonging to a gang |
aff_spe | specify NULL to skip affinity information |
Definition at line 183 of file create.c.
References _base_spe_emulated_loader_present(), spe_context::base_private, spe_gang_context::base_private, spe_context_base_priv::cntl_mmap_base, CNTL_OFFSET, CNTL_SIZE, DEBUG_PRINTF, spe_context_base_priv::fd_lock, spe_context_base_priv::fd_spe_dir, spe_context_base_priv::flags, spe_gang_context_base_priv::gangname, spe_context_base_priv::loaded_program, LS_SIZE, spe_context_base_priv::mem_mmap_base, spe_context_base_priv::mfc_mmap_base, MFC_OFFSET, MFC_SIZE, MSS_SIZE, spe_context_base_priv::mssync_mmap_base, MSSYNC_OFFSET, NUM_MBOX_FDS, spe_context_base_priv::psmap_mmap_base, PSMAP_SIZE, spe_context_base_priv::signal1_mmap_base, SIGNAL1_OFFSET, spe_context_base_priv::signal2_mmap_base, SIGNAL2_OFFSET, SIGNAL_SIZE, SPE_AFFINITY_MEMORY, SPE_CFG_SIGNOTIFY1_OR, SPE_CFG_SIGNOTIFY2_OR, SPE_EVENTS_ENABLE, spe_context_base_priv::spe_fds_array, SPE_ISOLATE, SPE_ISOLATE_EMULATE, and SPE_MAP_PS.
int _base_spe_context_destroy | ( | spe_context_ptr_t | spectx) |
_base_spe_context_destroy cleans up what is left when an SPE executable has exited. Closes open file handles and unmaps memory areas.
spectx | Specifies the SPE context |
Definition at line 418 of file create.c.
References __spe_context_update_event().
void _base_spe_context_lock | ( | spe_context_ptr_t | spe, |
enum fd_name | fd | ||
) |
_base_spe_context_lock locks members of the SPE context
spectx | Specifies the SPE context |
fd | Specifies the file |
Definition at line 91 of file create.c.
References spe_context::base_private, and spe_context_base_priv::fd_lock.
Referenced by _base_spe_close_if_open(), and _base_spe_open_if_closed().
void _base_spe_context_unlock | ( | spe_context_ptr_t | spe, |
enum fd_name | fd | ||
) |
_base_spe_context_unlock unlocks members of the SPE context
spectx | Specifies the SPE context |
fd | Specifies the file |
Definition at line 96 of file create.c.
References spe_context::base_private, and spe_context_base_priv::fd_lock.
Referenced by _base_spe_close_if_open(), and _base_spe_open_if_closed().
spe_gang_context_ptr_t _base_spe_gang_context_create | ( | unsigned int | flags) |
creates the directory in SPUFS that will contain all SPEs that are considered a gang Note: I would like to generalize this to a "group" or "set" Additional attributes maintained at the group level should be used to define scheduling constraints such "temporal" (e.g., scheduled all at the same time, i.e., a gang) "topology" (e.g., "closeness" of SPEs for optimal communication)
Definition at line 376 of file create.c.
References spe_gang_context::base_private, DEBUG_PRINTF, and spe_gang_context_base_priv::gangname.
int _base_spe_gang_context_destroy | ( | spe_gang_context_ptr_t | gctx) |
int _base_spe_open_if_closed | ( | struct spe_context * | spe, |
enum fd_name | fdesc, | ||
int | locked | ||
) |
Definition at line 101 of file create.c.
References _base_spe_context_lock(), _base_spe_context_unlock(), spe_context::base_private, spe_context_base_priv::fd_spe_dir, fd_attr::mode, fd_attr::name, spe_context_base_priv::spe_fds_array, and spe_context_base_priv::spe_fds_refcount.
Referenced by __base_spe_event_source_acquire(), _base_spe_in_mbox_status(), _base_spe_in_mbox_write(), _base_spe_mssync_start(), _base_spe_mssync_status(), _base_spe_out_intr_mbox_read(), _base_spe_out_intr_mbox_status(), _base_spe_out_mbox_read(), _base_spe_out_mbox_status(), and _base_spe_signal_write().