= GIET-VM / Syscall Handler functions = The [source:soft/giet_vm/giet_kernel/sys_handler.c sys_handler.c] and [source:soft/giet_vm/giet_kernel/sys_handler.h sys_handler.h] files define the kernel data structure and functions that are used to handle the system calls. They are prefixed by ''_'' to remind that they can only be executed by a processor in kernel mode. The [source:soft/giet_vm/giet_kernel/sys_handler.c _syscall_vector![64!]] array contains the 64 kernel functions defined by the GIET-VM to handle system calls. Most of these functions are provided by the peripheral drivers, but some services are provided by the kernel itself: === void _sys_ukn() === Function executed in case of undefined syscall === void _proc_xyp( unsigned int* x, unsigned int*, unsigned int* p ) === This function returns the processor (x,y,p) identifiers. === void _task_exit() === The calling task goes to sleeping state, after printing an exit message. It is descheduled and enters the "not runable" mode. === void _context_switch() === This function deschedules the calling task. It mask interrupts before calling the _ctx_switch, and restore it when the task is rescheduled. === unsigned int _local_task_id() === Returns current task local index (amongst tasks running on a given processor). === unsigned int _global_task_id() === Returns current task global index (amongst all tasks running on all processors). === unsigned int _thread_id() === Returns current thread index (amongst all tasks in a given multi-tasks application). === unsigned int _procs_number( unsigned int cluster_id, unsigned int* number ) === Returns in buffer argument the number of processors in cluster specified by the cluster_id argument. === unsigned int _get_vobj_ptr( char* vspace_name, char* vobj_name, mapping_vobj_t** pvobj ) === This function returns in the res_vobj argument a pointer on a vobj identified by the (vspace_name / vobj_name ) couple. Returns 0 if success, >0 if not found ///////////////////////////////////////////////////////////////////////////// // This function writes in vobj_vbase the virtual base address of a vobj // identified by the (vspace_name / vobj_name ) couple. // returns 0 if success, >0 if not found ///////////////////////////////////////////////////////////////////////////// unsigned int _vobj_get_vbase( char* vspace_name, char* vobj_name, unsigned int* vobj_vbase ); ///////////////////////////////////////////////////////////////////////////// // This function writes in vobj_length the length of a vobj // identified by the (vspace_name / vobj_name ) couple. // returns 0 if success, >0 if not found ///////////////////////////////////////////////////////////////////////////// unsigned int _vobj_get_length( char* vspace_name, char* vobj_name, unsigned int* vobj_length ); === unsigned int _get_xy_from_ptr( void* ptr, unsigned int* px, unsigned int* py ) === This function returns in the (x,y) arguments the coordinates of the cluster where is mapped the ptr virtual address. It use the _get_context_slot() function to get the calling task page table, and uses the _v2p_translate() function to obtain the physical address. Returns 0 if success, > 0 if ptr not mapped in the calling task vspace.