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

Definition at line 25 of file lib_builtin.h.

Referenced by _base_spe_callback_handler_deregister(), _base_spe_callback_handler_query(), and _base_spe_callback_handler_register().

#define RESERVED 4

Definition at line 26 of file lib_builtin.h.

Referenced by _base_spe_callback_handler_deregister(), and _base_spe_callback_handler_register().

## 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().

{
int (*handler)(void *, unsigned int);
int rc;
errno = 0;
if (!handlers[callnum]) {
DEBUG_PRINTF ("No SPE library handler registered for this call.\n");
errno=ENOSYS;
return -1;
}
handler=handlers[callnum];
/* For emulated isolation mode, position the
* npc so that the buffer for the PPE-assisted
* library calls can be accessed. */
if (spe->base_private->flags & SPE_ISOLATE_EMULATE)
npc = SPE_EMULATE_PARAM_BUFFER;
rc = handler(spe->base_private->mem_mmap_base, npc);
if (rc) {
DEBUG_PRINTF ("SPE library call unsupported.\n");
errno=ENOSYS;
return rc;
}
return 0;
}