#include "spebase.h"
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 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().
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().
00115 { 00116 int (*handler)(void *, unsigned int); 00117 int rc; 00118 00119 errno = 0; 00120 if (!handlers[callnum]) { 00121 DEBUG_PRINTF ("No SPE library handler registered for this call.\n"); 00122 errno=ENOSYS; 00123 return -1; 00124 } 00125 00126 handler=handlers[callnum]; 00127 00128 /* For emulated isolation mode, position the 00129 * npc so that the buffer for the PPE-assisted 00130 * library calls can be accessed. */ 00131 if (spe->base_private->flags & SPE_ISOLATE_EMULATE) 00132 npc = SPE_EMULATE_PARAM_BUFFER; 00133 00134 rc = handler(spe->base_private->mem_mmap_base, npc); 00135 if (rc) { 00136 DEBUG_PRINTF ("SPE library call unsupported.\n"); 00137 errno=ENOSYS; 00138 return rc; 00139 } 00140 return 0; 00141 }