Changes between Version 104 and Version 105 of library_stdio


Ignore:
Timestamp:
Sep 15, 2015, 10:28:22 AM (9 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • library_stdio

    v104 v105  
    11= GIET_VM / User-Level System Calls =
    22
    3 The [source:soft/giet_vm/giet_libs/stdio.c stdio.c] and [source:soft/giet_vm/giet_libs/stdio.h stdio.h] files define all system calls provided to user applications by the GIET-VM. They are generally prefixed by ''giet_''.
     3The  [source:soft/giet_vm/giet_libs/stdio.c stdio.c] and [source:soft/giet_vm/giet_libs/stdio.h stdio.h] files define all system calls provided to user applications by the GIET-VM. They are generally prefixed by ''giet_''.
    44
    55[[PageOutline]]
    66
    77All these functions use a ''syscall'' instruction to enter the system.
    8 In  case of system call failure (illegal arguments), the calling task
    9 is killed with a ''giet_exit()''.
    10 
    11 Therefore, for all these system calls, the return value has not to be tested by the calling task.
     8In  case of system call failure (illegal arguments), the calling thread
     9is killed with a ''giet_pthread_exit()''.
     10
     11Therefore, for most of these system calls, there is no return value.
    1212
    1313 == __Processor related system calls__ ==
     14
     15These system calls access the MIPS32 protected registers CP0_PROCID and CP0_TIME.
    1416
    1517 === 1) void '''giet_proc_xyp'''( unsigned int* cluster_x, unsigned int* cluster_y unsigned int* lpid )===
     
    2931
    3032
    31  == __Task related system calls__ ==
    32 
    33  === 1) unsigned int '''giet_proc_task_id'''() ===
    34 This functions returns (from the calling task context) the task index in scheduler, identifying the task amongst all task
    35 running on the same processor.
    36 No error possible.
    37 
    38  === 2) unsigned int '''giet_global_task_id'''() ===
    39 This functions returns (from the calling task context) the global task id, unique in the system.
     33 == __Thread related system calls__ ==
     34
     35The following system calls implement the POSIX Threads. The ''pthread_t'' and ''pthread_attr_t'' types
     36are defined in the [source:soft/giet_vm/giet_libs/stdio.h stdio.h] file.
     37
     38 === 1)  int '''giet_pthread_create'''( pthread_t*  buffer , pthread_attr_t* attr , void* function , void* arg ) ===
     39This functions activates one thread that will execute the C function defined by the ''function'' argument.
     40All thread activated by this system call must have been defined in the application mapping.
     41The ''attr'' argument (pthread attributes) is not supported, and should be set to NULL: The stack size must be defined in the mapping, and the pthread is activated in attached mode. In the current implementation, the ''arg'' argument (argument to be passed to ''function'') is not supported, and should be set to NULL.
     42The thread identifier stored in the ''buffer'' argument by the kernel is unique in a given space: It is actually build from the 4 following informations : [x,y,p,ltid], where x,y,p are the processor coordinates, and ltid is the thread index in the scheduler.   
     43 * buffer : pointer on a buffer that will contain the activated thread identifier.
     44 * attr :  not supported in the current implementation and must be set to NULL.
     45 * function : pointer on function
     46 * arg : not supported
     47Return 0 if success.
     48Return -1  if no matching thread.
     49Return -2  if attr or arg not NULL.
     50
     51 === 2) void '''giet_pthread_exit'''( void* string ) ===
     52This function desactivates the calling thread.
     53The 'string' argument is a (user defined) log message displayed on the kernel TTY.
     54
     55 === 3) unsigned int '''giet_pthread_join'''( pthread_t  trdid , void** ptr ) ===
     56This blocking function can be used to detect completion of a thread activated by a giet_pthread_create().
     57It returns only when the thread identified by the ''traded'' argument is desactivated.
     58The ''ptr'' argument is not supported, and should be set to NULL.
     59 * trdid : unique thread identifier in vspace.
     60 * ptr : not supported.
     61Return 0 if success.
     62Return -1  if no matching thread.
     63Return -2  if ptr not NULL
     64
    4065No error possible.
    4166