= GIET-VM / Thread context access functions = [[PageOutline]] The [source:soft/giet_vm/giet_common/utils.c utils.c] and [source:soft/giet_vm/giet_common/utils.h utils.h] files define the functions used to access the thread contexts. The codes used to identify the various context slots are defined [source:soft/giet_vm/giet_kernel/ctx_handler.h here]. These functions are prefixed by "_" to remind that they can only be executed by a processor in kernel mode. === 1) unsigned int '''_get_thread_ltid'''( void ) === This function returns the local index of the calling thread (scheduler index). === 2) unsigned int '''_get_thread_trdid'''( void ) === This function returns the global thread identifier of the calling thread (x<<24 + y<<16 + p<<8 + ltid). === 3) unsigned int '''_get_task_slot'''( unsigned int x, unsigned int y, unsigned int p, unsigned int ltid, unsigned int slot ) === This function returns the content of a context slot for any thread running on any processor. * '''x''' : cluster x coordinate * '''y''' : cluster y coordinate * '''p''' : processor local index * '''ltid''' : task local index * '''slot''' : slot index === 4) void '''_set_task_slot'''( unsigned int x, unsigned int y, unsigned int p, unsigned int ltid, unsigned int slot, unsigned int value ) === This function updates the content of a context slot for any thread running on any processor. * '''x''' : cluster x coordinate * '''y''' : cluster y coordinate * '''p''' : processor local index * '''ltid''' : task local index * '''slot''' : slot index === 5) unsigned int '''_get_context_slot'''( unsigned int slot ) === This function returns the content of a context slot for the calling thread. === 6) void '''_set_context_slot'''( unsigned int slot, unsigned int value ) === This function updates the content of a context slot for the calling thread.