Changeset 457 for trunk/hal/generic


Ignore:
Timestamp:
Aug 2, 2018, 11:47:13 AM (3 years ago)
Author:
alain
Message:

This version modifies the exec syscall and fixes a large number of small bugs.
The version number has been updated (0.1)

Location:
trunk/hal/generic
Files:
14 edited

Legend:

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

    r408 r457  
    2626
    2727#include <kernel_config.h>
    28 #include <hal_types.h>
     28#include <hal_kernel_types.h>
    2929
    3030//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_context.h

    r408 r457  
    4343 * identified by the <thread> argument. The context is not initialised.
    4444 ****************************************************************************************
     45 * @ thread  : pointer on the thread descriptor.
    4546 * @ return 0 if success / return -1 if failure.
    4647 ***************************************************************************************/
     
    4849
    4950/****************************************************************************************
    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.
     51 * This function initializes a CPU context from scratch.
    5252 ****************************************************************************************
    5353 * @ thread  : pointer on the thread descriptor.
    54  * @ return 0 if success / return -1 if failure.
    5554 ***************************************************************************************/
    56 error_t hal_cpu_context_create( struct thread_s * thread );
     55void hal_cpu_context_init( struct thread_s * thread );
    5756
    5857/****************************************************************************************
     
    7170
    7271/****************************************************************************************
     72 * This function is used to implement the exec() system call.
     73 * 1) It initialize the relevant slots of the the calling thread CPU context.
     74 * 2) It call the hal_do_cpu_restore() function to return to user mode and start
     75 *    execution of the new process.
     76 ****************************************************************************************
     77 * @ thread  : pointer on the thread descriptor.
     78 ***************************************************************************************/
     79void hal_cpu_context_exec( struct thread_s * thread );
     80
     81/****************************************************************************************
    7382 * This function display some slots of the CPU context.
    74  * - For the MIPS32 :
    75  *   . GPR : gp_28 , sp_29 , ra_31
    76  *   . CP0 : c0_sr , c0_th , c0_epc
    77  *   . CP2 : c2_ptpr , c2-mode
    78  * - For X86 TODO :
    7983 ****************************************************************************************
    8084 * @ thread_xp  : extended pointer on the thread descriptor.
     
    103107 ***************************************************************************************/
    104108error_t hal_fpu_context_alloc( struct thread_s * thread );
     109
     110/****************************************************************************************
     111 * This function initializes a FPU context from scratch.
     112 ****************************************************************************************
     113 * @ thread  : pointer on the thread descriptor.
     114 ***************************************************************************************/
     115void hal_fpu_context_init( struct thread_s * thread );
    105116
    106117/****************************************************************************************
  • trunk/hal/generic/hal_exception.h

    r455 r457  
    2525#define _HAL_EXCEPTION_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_kernel_types.h>
    2828
    2929//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_gpt.h

    r432 r457  
    2525#define _GPT_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_kernel_types.h>
    2828
    2929/////////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_interrupt.h

    r408 r457  
    2525#define _HAL_INTERRUPT_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_kernel_types.h>
    2828
    2929///////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_irqmask.h

    r279 r457  
    2626#define  _HAL_IRQMASK_H_
    2727
    28 #include <hal_types.h>
     28#include <hal_shared_types.h>
    2929
    3030
  • trunk/hal/generic/hal_ppm.h

    r409 r457  
    2626#define _HAL_PPM_H_
    2727
    28 #include <hal_types.h>
     28#include <hal_kernel_types.h>
    2929#include <boot_info.h>
    3030
  • trunk/hal/generic/hal_remote.h

    r407 r457  
    2626#define  _HAL_REMOTE_H_
    2727
    28 #include <hal_types.h>
     28#include <hal_kernel_types.h>
    2929
    3030//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_special.h

    r408 r457  
    2525#define  _HAL_CPU_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_shared_types.h>
     28#include <hal_kernel_types.h>
    2829
    2930/****  Forward declarations  ***/
  • trunk/hal/generic/hal_switch.h

    r408 r457  
    2828
    2929/*************************************************************************************
    30  * The hal_do_cpu_switch() function is an assembly level function, called by the
    31  * sched_yield() function, to make a CPU context switch.
    32  * The current thread CPU context is identified by the <ctx_current> pointer.
    33  * The new thread CPU context is identified by the <ctx_next> pointer.
     30 * This assembly level function is called by the sched_yield() function,
     31 * to make a CPU context switch.
     32 * The current thread CPU context is identified by the <ctx_old> pointer.
     33 * The new thread CPU context is identified by the <ctx_new> pointer.
    3434 * The architecture specific hal_cpu_context_t structure used to store a CPU context
    3535 * is defined in the architecture specific hal_context.c file.
     
    4545
    4646/*************************************************************************************
    47  * The hal_do_cpu_save() function is an assembly level function, called by the
    48  * hal_cpu_context_save() functio to save the calling CPU register values to a
    49  * CPU context identified by the <ctx> pointer.
     47 * This assembly level function is called by the hal_cpu_context_fork() function.
     48 * It save the calling CPU register values to a CPU context identified by <ctx>.
    5049 * This function does NOT modify any register before saving values into context.
    5150 * The architecture specific hal_cpu_context_t structure used to store a CPU context
     
    5756void hal_do_cpu_save( void * ctx );
    5857
     58/*************************************************************************************
     59 * This assembly level function, is called by the hal_cpu_context_exec() function.
     60 * It restore the calling CPU register values from a CPU context identified by <ctx>.
     61 * The architecture specific hal_cpu_context_t structure used to store a CPU context
     62 * is defined in the architecture specific hal_context.c file.
     63 * When the restore is completed, it simply jumps to the address contained in ra_31.
     64 * In ALMOS-MKH, ra_31 must contain a pointer on the eret() function, and c0_epc
     65 * must contain the new main thread entry point.
     66 *************************************************************************************
     67 * @ ctx     : local pointer on CPU context.
     68 ************************************************************************************/
     69void hal_do_cpu_restore( void * ctx );
     70
    5971#endif  /* _HAL_SWITCH_H_ */
  • trunk/hal/generic/hal_syscall.h

    r408 r457  
    2525#define _HAL_KERNEL_SYSCALL_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_kernel_types.h>
    2828
    2929///////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_user.h

    r445 r457  
    2525#define _HAL_USER_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_shared_types.h>
    2828
    2929//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_uspace.h

    r407 r457  
    2525#define  _HAL_USPACE_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_kernel_types.h>
    2828
    2929//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/hal/generic/hal_vmm.h

    r411 r457  
    2525#define _HAL_PPM_H_
    2626
    27 #include <hal_types.h>
     27#include <hal_kernel_types.h>
    2828#include <boot_info.h>
    2929
Note: See TracChangeset for help on using the changeset viewer.