libspe2  0.9a
Macros | Functions
lib_builtin.h File Reference
#include "spebase.h"
Include dependency graph for lib_builtin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_CALLNUM   255
 
#define RESERVED   4
 

Functions

int _base_spe_handle_library_callback (struct spe_context *spe, int callnum, unsigned int npc)
 

Macro Definition Documentation

#define MAX_CALLNUM   255
#define RESERVED   4

Function Documentation

int _base_spe_handle_library_callback ( struct spe_context spe,
int  callnum,
unsigned int  npc 
)

Definition at line 113 of file lib_builtin.c.

References spe_context::base_private, DEBUG_PRINTF, spe_context_base_priv::flags, spe_context_base_priv::mem_mmap_base, SPE_EMULATE_PARAM_BUFFER, and SPE_ISOLATE_EMULATE.

Referenced by _base_spe_context_run().

115 {
116  int (*handler)(void *, unsigned int);
117  int rc;
118 
119  errno = 0;
120  if (!handlers[callnum]) {
121  DEBUG_PRINTF ("No SPE library handler registered for this call.\n");
122  errno=ENOSYS;
123  return -1;
124  }
125 
126  handler=handlers[callnum];
127 
128  /* For emulated isolation mode, position the
129  * npc so that the buffer for the PPE-assisted
130  * library calls can be accessed. */
133 
134  rc = handler(spe->base_private->mem_mmap_base, npc);
135  if (rc) {
136  DEBUG_PRINTF ("SPE library call unsupported.\n");
137  errno=ENOSYS;
138  return rc;
139  }
140  return 0;
141 }