| 1 | = GIET-VM / Syscall Handler functions = |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | 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, |
| 6 | but some services are provided by the kernel itself: |
| 7 | |
| 8 | === void _sys_ukn() === |
| 9 | Function executed in case of undefined syscall |
| 10 | |
| 11 | === void _proc_xyp( unsigned int* x, unsigned int*, unsigned int* p ) === |
| 12 | This function returns the processor (x,y,p) identifiers. |
| 13 | |
| 14 | === void _task_exit() === |
| 15 | The calling task goes to sleeping state, after printing an exit message. |
| 16 | It is descheduled and enters the "not runable" mode. |
| 17 | |
| 18 | === void _context_switch() === |
| 19 | This function deschedules the calling task. It mask interrupts before calling the _ctx_switch, and restore it when the task is rescheduled. |
| 20 | |
| 21 | === unsigned int _local_task_id() === |
| 22 | Returns current task local index (amongst tasks running on a given processor). |
| 23 | |
| 24 | === unsigned int _global_task_id() === |
| 25 | Returns current task global index (amongst all tasks running on all processors). |
| 26 | |
| 27 | === unsigned int _thread_id() === |
| 28 | Returns current thread index (amongst all tasks in a given multi-tasks application). |
| 29 | |
| 30 | === unsigned int _procs_number( unsigned int cluster_id, unsigned int* number ) === |
| 31 | Returns in buffer argument the number of processors in cluster specified by the cluster_id argument. |
| 32 | |
| 33 | === unsigned int _get_vobj_ptr( char* vspace_name, char* vobj_name, mapping_vobj_t** pvobj ) === |
| 34 | 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 |
| 35 | |
| 36 | |
| 37 | |
| 38 | ///////////////////////////////////////////////////////////////////////////// |
| 39 | // This function writes in vobj_vbase the virtual base address of a vobj |
| 40 | // identified by the (vspace_name / vobj_name ) couple. |
| 41 | // returns 0 if success, >0 if not found |
| 42 | ///////////////////////////////////////////////////////////////////////////// |
| 43 | unsigned int _vobj_get_vbase( char* vspace_name, |
| 44 | char* vobj_name, |
| 45 | unsigned int* vobj_vbase ); |
| 46 | |
| 47 | ///////////////////////////////////////////////////////////////////////////// |
| 48 | // This function writes in vobj_length the length of a vobj |
| 49 | // identified by the (vspace_name / vobj_name ) couple. |
| 50 | // returns 0 if success, >0 if not found |
| 51 | ///////////////////////////////////////////////////////////////////////////// |
| 52 | unsigned int _vobj_get_length( char* vspace_name, |
| 53 | char* vobj_name, |
| 54 | unsigned int* vobj_length ); |
| 55 | |
| 56 | === unsigned int _get_xy_from_ptr( void* ptr, unsigned int* px, unsigned int* py ) === |
| 57 | 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. |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |