libspe2 0.9a
Defines | 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.

Defines

#define MAX_CALLNUM   255
#define RESERVED   4

Functions

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

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

{
        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;
}