Changeset 296 for trunk/hal/generic


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

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

Location:
trunk/hal/generic
Files:
3 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
  • trunk/hal/generic/hal_ppm.h

    r64 r296  
    5454error_t hal_ppm_init( boot_info_t * info );
    5555
     56/****************************************************************************************
     57 * This function initializes the architecture specific core registers, for the
     58 * calling core. It is executed by all cores during kernel_init().
     59 ****************************************************************************************
     60 * @ info       : pointer on the boot_info structure.
     61 ***************************************************************************************/
     62void hal_core_init( boot_info_t * info );
     63
     64
     65
    5666#endif  /* HAL_PPM_H_ */
  • trunk/hal/generic/hal_special.h

    r279 r296  
    3434//      Generic Special Registers Access API (implementation in hal_special.c)
    3535//
    36 // ALMOS-MKH uses the following API to access the MMU and other core protected registers.
     36// ALMOS-MKH uses the following API to access the core protected registers.
    3737///////////////////////////////////////////////////////////////////////////////////////////
    3838
     
    5050 * This function returns the current value of the hardware cycles counter.
    5151 ****************************************************************************************/
    52 inline cycle_t hal_time_stamp();
     52inline reg_t hal_time_stamp();
    5353
    5454/*****************************************************************************************
    55  * This function returns the content of the calling core private cycles counter.
     55 * This function returns the content of the calling core private cycles counter,
     56 * taking into account overflow if the core hardware register is not 64 bits.
    5657 * This cycle counter is reset when the core is initialised (at each boot).
    57  * If the hardware counter is not a 64 bits register, this function must handle overflow.
    5858 ****************************************************************************************/
    59 uint64_t hal_get_cycles();
     59cycle_t hal_get_cycles();
    6060
    6161/*****************************************************************************************
     
    6868 ****************************************************************************************/
    6969void hal_set_current_thread( struct thread_s * thread );
     70
     71/*****************************************************************************************
     72 * This function registers a new kentry base address in the relevant core register.
     73 ****************************************************************************************/
     74void hal_set_ebase( reg_t base );
    7075
    7176/*****************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.