Changes between Version 8 and Version 9 of kernel_syscalls


Ignore:
Timestamp:
Oct 29, 2014, 11:25:40 AM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_syscalls

    v8 v9  
    77The [source:soft/giet_vm/giet_kernel/sys_handler.c _syscall_vector] array contains the 64 kernel functions (syscal handlers) defined by the GIET-VM to handle system calls.
    88
    9 == __Miscelaneous syscall handlers__ ==
    10 
    11 === void '''_sys_ukn'''() ===
    12 Function executed in case of undefined syscall
    13 
    14 === void '''_sys_proc_xyp'''( unsigned int* x,  unsigned int*,   unsigned int* p ) ===
    15 This function returns the processor (x,y,p) identifiers.
    169
    1710== __TTY related syscall handlers__ ==
    1811
    1912=== int '''_sys_tty_alloc'''() ===
     13This function allocates a private TTY terminal to the calling task, and registers the TTY index in the task context.
     14Returns 0 if success, returns -1 if not enough terminals.
    2015
    2116=== int '''_sys_tty_write'''( const char*  buffer,  unsigned int length,  unsigned int channel ) === 
    2217This non-blocking function writes a character string from a fixed-length buffer to a TTY terminal identified by the channel argument. If channel argument is 0xFFFFFFFF, the TTY index is found in the task context.
    23 It is non blocking: it tests the TTY_STATUS register, and stops the transfer as soon as the TTY_STATUS[WRITE] bit is set. Returns  the number of characters that have been written.
     18It is non blocking: it tests the TTY_STATUS register, and stops the transfer as soon as the TTY_STATUS[WRITE] bit is set. Returns -1 if no TTT terminal allocated to the calling task. Returns  the number of characters that have been written if a terminal is allocated.
    2419
    2520=== int '''_sys_tty_read'''(  char* buffer,  unsigned int length,  unsigned int channel ) ===
    26 This non-blocking function fetches one character from the terminal identified by the channel argument. If the channel argument is 0xFFFFFFFF, the channel index is obtained from the current task context.
     21This non-blocking function fetches one character from the terminal identified by the ''channel'' argument. If the ''channel'' argument is 0xFFFFFFFF, the TTY index is obtained from the current task context.
    2722It uses the TTY_GET_IRQ[tty_id] interrupt and the buffer must have been filled by the TTY_ISR.
    2823It test the _tty_rx_full[tty_id] variable, read the _tty_rx_buf[tty_id] buffer, writes this character to the target buffer, and resets the_tty_rx_full[tty_id] register. The length argument is not used.
    29 Returns  the number of characters that have been read (0/1).
     24Returns -1 if no TTY terminal allocated to the calling task. Returns  the number of characters that have been read if a terminal is allocated (can be 0 or 1).
    3025
    31 === void '''_sys_tty_get_lock'''( unsigned int  channel,   unsigned int* save_sr_ptr ) ===
    32 This blocking function try to take the lock protecting exclusive access to TTY terminal identified by the "channel" argument.
    33 It enters a critical section before taking the lock, and save the SR value at address defined by the ''save_sr_ptr'' argument.
    34 It returns only when the lock has been successfully taken.
     26=== int '''_sys_tty_get_lock'''( unsigned int  channel,   unsigned int* save_sr_ptr ) ===
     27This blocking function try to take the lock protecting exclusive access to TTY terminal identified by the "channel" argument. It enters a critical section before taking the lock, and save the SR value at address defined by the ''save_sr_ptr'' argument. Returns -1 if no TTY terminal allocated to the calling task. If a TTY terminal is allocated, it returns only when the lock has been successfully taken.
    3528
    36 === void '''_sys_tty_release_lock'''( unsigned int  channel,  unsigned int* save_sr_ptr ) ===
    37 This function releases the lock protecting exclusive access to TTY terminal identified by the channel argument.
    38 It exit the critical section after lock release, and restore SR value from address defined by the ''save_sr_ptr'' argument.
     29=== int '''_sys_tty_release_lock'''( unsigned int  channel,  unsigned int* save_sr_ptr ) ===
     30This function releases the lock protecting exclusive access to TTY terminal identified by the ''channel'' argument.
     31It exit the critical section after lock release, and restore SR value from address defined by the ''save_sr_ptr'' argument. Returns -1 if no TTY terminal allocated to the calling task.
     32
     33
    3934
    4035== __TIM retated syscall handlers__ ==
    4136
    42 === int '''_sys_timer_alloc'''() ===
     37=== int '''_sys_tim_alloc'''() ===
    4338This function allocates a private timer to the calling task, and register the timer index in the task context.
    4439Return -1 if no timer available.
    4540
    46 === int '''_sys_timer_start'''( unsigned int period ) ===
     41=== int '''_sys_tim_start'''( unsigned int period ) ===
    4742This function starts the user timer channel allocated to the calling task.
    48 Returns -1 if no allocated timer.
     43Returns 0 if success. Returns -1 if no allocated timer.
    4944
    50 === int '''_sys_timer_stop'''() ===
     45=== int '''_sys_tim_stop'''() ===
    5146This function stops the user timer channel allocated to the calling task.
    52 Returns -1 if no allocated timer.
     47Returns 0 if success. Returns -1 if no allocated timer.
    5348
    54 === void '''_task_exit'''() ===
     49
     50
     51== __NIC related syscall handlers__ ==
     52
     53=== int '''_sys_nic_alloc'''() ===
     54This function allocates a private NIC channel to the calling task, and register the channel index in the task context.
     55Return -1 if no NIC channel available.
     56
     57=== int '''_sys_nic_sync_send'''( void* vbuf ) ===
     58This function uses a physical_memcpy() to transfer a 4kbytes container from an user buffer to a private NIC TX channel. It computes the physical base address associated to the user buffer. Returns 0 if success, returns -1 if the buffer address is illegal, or if there is no  NIC channel allocated to the calling task.
     59
     60=== int '''_sys_nic_sync_receive'''( void* vbuf ) ===
     61This function uses a physical_memcpy() to transfer a 4kbytes container from a private NIC RX channel to an user buffer. It computes the physical base address associated to the user buffer. Returns 0 if success, returns -1 if the buffer address is illegal, or if there is no  NIC channel allocated to the calling task.
     62
     63
     64
     65== __Miscelaneous syscall handlers__ ==
     66
     67=== int '''_sys_ukn'''() ===
     68Function executed in case of undefined syscall
     69
     70=== int '''_sys_proc_xyp'''( unsigned int* x,  unsigned int*,   unsigned int* p ) ===
     71This function returns the processor (x,y,p) identifiers.
     72
     73=== int '''_sys_task_exit'''() ===
    5574The calling task goes to sleeping state, after printing an exit message.
    5675It is descheduled and enters the "not runable" mode.
    5776
    58  === void '''_context_switch'''() ===
     77 === int '''_context_switch'''() ===
    5978This function deschedules the calling task. It mask interrupts before calling the _ctx_switch, and restore it when the task is rescheduled.
    6079
    61  === unsigned int '''_local_task_id'''() ===
    62 Returns current task local index (amongst tasks running on a given processor).
     80 === int '''_sys_local_task_id'''() ===
     81This function returns the current task local index (amongst tasks running on a given processor).
    6382
    64  === unsigned int '''_global_task_id'''() ===
    65 Returns current task global index (amongst all tasks running on all processors).
     83 === int ''_sys'_global_task_id'''() ===
     84This function returns the current task global index (amongst all tasks running on all processors).
    6685
    67 === unsigned int '''_thread_id'''() ===
    68 Returns current thread index (amongst all tasks in a given multi-tasks application).
     86=== int '''_sys_thread_id'''() ===
     87This function returns the current task thread index (amongst all tasks in a given multi-tasks application).
    6988
    70  === unsigned int '''_procs_number'''( unsigned int  cluster_id, unsigned int* number ) ===
    71 Returns in buffer argument the number of processors in cluster specified by the cluster_id argument.
     89 === int '''_sys_procs_number'''( unsigned int  x,  unsigned int y, unsigned int* number ) ===
     90Returns in the ''number'' argument the number of processors in cluster[x,y].
    7291
    73  === unsigned int '''_get_vobj_ptr'''( char* vspace_name,  char* vobj_name,  mapping_vobj_t**  pvobj ) ===
    74 This function returns in the res_vobj argument a pointer on a vobj identified by the (vspace_name / vobj_name ) couple.
    75 Returns 0 if success, >0 if not found
     92 === int '''_sys_vobj_get_vbase'''( char* vspace_name,  char* vobj_name,  unsigned int* vbase ) ===
     93This function returns in the ''vbase'' argument the virtual base address of the vobj identified by the (vspace_name / vobj_name ) couple. Returns 0 if success, -1 if vobj not found.
    7694
    77  === unsigned int '''_vobj_get_vbase'''( char* vspace_name,  char* vobj_name,  unsigned int* vobj_vbase ) ===
    78 This function writes in vobj_base the virtual base address of a vobj  identified by the (vspace_name / vobj_name ) couple.
    79 Returns 0 if success, >0 if not found
     95 === int '''_sys_vobj_get_length'''( char* vspace_name,  char* vobj_name,  unsigned int* length ) ===
     96This function returns in the ''length'' argument the length of the vobj identified by the (vspace_name / vobj_name ) couple. Returns 0 if success, -1 if vobj not found
    8097
    81  === unsigned int '''_vobj_get_length'''( char* vspace_name,  char* vobj_name,  unsigned int* vobj_length ) ===
    82 This function writes in vobj_length the length of a vobj identified by the (vspace_name / vobj_name ) couple.
    83 Returns 0 if success, >0 if not found
     98 === int '''_sys_xy_from_ptr'''( void* ptr,  unsigned int*  x,  unsigned int*  y ) ===
     99This 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, -1 if ptr not mapped in the calling task vspace.
    84100
    85  === unsigned int '''_get_xy_from_ptr'''( void* ptr,  unsigned int*  px,  unsigned int*  py ) ===
    86 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.
     101 === int '''_sys_heap_info'''( unsigned int* vaddr,   unsigned int* length,   unsigned int  x,  unsigned int  y ) ===
     102This function returns the information associated to a heap : vaddr and length.
     103 * If (x < X_SIZE) and (y < Y_SIZE), it return the heap associated to any task running in cluster(x,y).
     104 * else, it return the heap associated to the calling task.
     105It uses the global task index (CTX_GTID_ID, unique for each giet task) and the vspace index (CTX_VSID_ID), that are defined in the calling task context to find the vobj_id containing the heap.
     106Returns 0 if success, returns -1 if not found.
    87107
    88108
     
    90110
    91111
     112