Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (6 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/generic/hal_context.h

    r337 r407  
    4040
    4141/****************************************************************************************
    42  * This function allocates, from the local cluster, the physical memory required for
    43  * the thread CPU context, initialises it, and links the context to the thread.
     42 * This function allocates memory for a CPU context and links it to the thread
     43 * identified by the <thread> argument. The context is not initialised.
     44 ****************************************************************************************
     45 * @ return 0 if success / return -1 if failure.
     46 ***************************************************************************************/
     47error_t hal_cpu_context_alloc( struct thread_s * thread );
     48
     49/****************************************************************************************
     50 * This function allocates memory for a CPU context, initialize it from scratch,
     51 * and links it to the thread identified by the <thread> argument.
    4452 ****************************************************************************************
    4553 * @ thread  : pointer on the thread descriptor.
    46  * @ return 0 if success / return ENOMEM if error
     54 * @ return 0 if success / return -1 if failure.
    4755 ***************************************************************************************/
    4856error_t hal_cpu_context_create( struct thread_s * thread );
    4957
    5058/****************************************************************************************
    51  * This function allocates, from the local cluster, the physical memory required for
    52  * a thread CPU context, initialises it from values contained in "src" thread context,
    53  * and links the context to the "dst" thread.
     59 * This function display the following slots of a thread CPU context:
     60 * - GPR : gp_28 , sp_29 , ra_31
     61 * - CP0 : c0_sr , c0_th , c0_epc
     62 * - CP2 : c2_ptpr , c2-mode
    5463 ****************************************************************************************
    55  * @ dst  : pointer on the destination thread descriptor.
    56  * @ src  : pointer on the source thread descriptor.
    57  * @ return 0 if success / return ENOMEM if error
     64 * @ thread  : local pointer on the thread descriptor.
    5865 ***************************************************************************************/
    59 error_t hal_cpu_context_copy( struct thread_s * dst,
    60                               struct thread_s * src );
     66void hal_cpu_context_display( struct thread_s * thread );
    6167
    6268/****************************************************************************************
     
    6773void hal_cpu_context_destroy( struct thread_s * thread );
    6874
    69 /****************************************************************************************
    70  * This function performs a context switch, saving the CPU register values into the
    71  * old thread, and initializing these registers with the values of the new thread.
    72  ****************************************************************************************
    73  * @ old     : pointer on current thread.
    74  * @ new     : pointer on the thread we want to switch to.
    75  ***************************************************************************************/
    76 void hal_cpu_context_switch( struct thread_s * old , struct thread_s * new );
     75
     76
     77
     78
     79
    7780
    7881/****************************************************************************************
    79  * This function loads the relevant CPU registers from values contained in
    80  * the thread context. It should be called for a thread that has not been executed yet.
    81  * It reset the loadable flag in thread descriptor.
     82 * This function allocates memory for a FPU context, reset all entries,
     83 * and links it to the thread identified by the <thread> argument.
    8284 ****************************************************************************************
    8385 * @ thread  : pointer on the thread descriptor.
     86 * @ return 0 if success / return -1 if failure.
    8487 ***************************************************************************************/
    85 void hal_cpu_context_load( struct thread_s * thread );
     88error_t hal_fpu_context_alloc( struct thread_s * thread );
    8689
    8790/****************************************************************************************
    88  * This function allocates, from the local cluster, the physical memory required for
    89  * the thread FPU context, and initialises the thread pointer.
    90  ****************************************************************************************
    91  * @ thread  : pointer on the thread descriptor.
    92  * @ return 0 if success / return ENOMEM if error
    93  ***************************************************************************************/
    94 error_t hal_fpu_context_create( struct thread_s * thread );
    95 
    96 /****************************************************************************************
    97  * This function allocates, from the local cluster, the physical memory required for
    98  * a thread FPU context, initialises it from values contained in "src" thread context,
    99  * and link the context to the "dst" thread.
     91 * This function copies a FPU context defined by the <src> argument to the FPU context
     92 * defined by the <dst> argument. It is used by the fork system call.
    10093 ****************************************************************************************
    10194 * @ dst  : pointer on the destination thread descriptor.
    10295 * @ src  : pointer on the source thread descriptor.
    103  * @ return 0 if success / return ENOMEM if error
    10496 ***************************************************************************************/
    105 error_t hal_fpu_context_copy( struct thread_s * dst,
     97void hal_fpu_context_copy( struct thread_s * dst,
    10698                           struct thread_s * src );
    10799
Note: See TracChangeset for help on using the changeset viewer.