Ignore:
Timestamp:
Jul 31, 2017, 1:59:52 PM (4 years ago)
Author:
alain
Message:

Several modifs in the generic scheduler and in the hal_context to
fix the context switch mechanism.

File:
1 edited

Legend:

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

    r151 r296  
    3232// void* pointers stored in the thread descriptor.
    3333// - the "hal_context_t" structure is used to store the CPU registers values that
    34 //   have not been saved in the stack by the interrupt handler.
     34//   have not been saved in the kernel stack by the interrupt handler.
    3535// - the "hal_fpu_context_t" structure is used to save the FPU registers when required.
    3636//////////////////////////////////////////////////////////////////////////////////////////
     
    4343 * This function allocates, from the local cluster, the physical memory required for
    4444 * the thread CPU context, initialises it, and links the context to the thread.
    45  * Seven registers are initialised:
    46  * - sp_29 / fp_30 / ra_31
    47  * - c0_sr / c0_th
    48  * - c2_ptpr / c2_mode
    4945 ****************************************************************************************
    5046 * @ thread  : pointer on the thread descriptor.
     
    7369
    7470/****************************************************************************************
    75  * This function saves in the thread context the CPU registers values that have not
    76  * been saved in the thread stack by the exception handler:
    77  * - GRs : s0 to S7 , sp , fp, ra
    78  * - CP0 : th
    79  * - CP2 : ptpr , mode
     71 * This function saves in the thread context the CPU registers values that must be
     72 * saved at context switch.
    8073 ****************************************************************************************
    81  * @ thread  : pointer on the thread descriptor.
     74 * @ ctx     : pointer on cpu context.
    8275 ***************************************************************************************/
    83 void hal_cpu_context_save( struct thread_s * thread );
     76void hal_cpu_context_save( void * ctx );
    8477
    8578/****************************************************************************************
    86  * This function restores from the thread context the CPU registers values that have not
    87  * been saved in the thread stack by the exception handler.
    88  * - GRs : s0 to S7 , sp , fp, ra
    89  * - CP0 : th
    90  * - CP2 : ptpr , mode
     79 * This function restores from the thread context the CPU registers values that must
     80 * be restored at context switch.
    9181 ****************************************************************************************
    92  * @ thread  : pointer on the thread descriptor.
     82 * @ ctx     : pointer on cpu context.
    9383 ***************************************************************************************/
    94 void hal_cpu_context_restore( struct thread_s * thread );
     84void hal_cpu_context_restore( void * ctx );
    9585
    9686/****************************************************************************************
    9787 * This function loads the relevant CPU registers from values contained in
    9888 * the thread context. It should be called for a thread that has not been executed yet.
    99  * - GRs : sp , fp , a0
    100  * - CP0 : sr , epc , th
    101  * - CP2 : ptpr , mode
    10289 * It reset the loadable flag in thread descriptor.
    10390 ****************************************************************************************
     
    10592 ***************************************************************************************/
    10693void hal_cpu_context_load( struct thread_s * thread );
    107 
    10894
    10995
Note: See TracChangeset for help on using the changeset viewer.