Ignore:
Timestamp:
Dec 5, 2017, 4:20:07 PM (4 years ago)
Author:
alain
Message:

Fix several bugs in the fork() syscall.

File:
1 edited

Legend:

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

    r407 r408  
    5757
    5858/****************************************************************************************
    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
     59 * This function is used to implement the fork() system call.
     60 * 1) It saves in a remote (child) thread CPU context the current CPU registers values.
     61 *    Three slots are not simple copies of the parent registers values :
     62 *    - the thread pointer is set to the child thread local pointer.
     63 *    - the stack pointer is set to parrent SP + (child_base - parent_base).
     64 *    - the status register is set to kernel mode with IRQ disabled.
     65 * 2) It copies the content of the calling (parent) thread kernel_stack,
     66 *    to the remote (child) thread kernel_stack.
    6367 ****************************************************************************************
    64  * @ thread  : local pointer on the thread descriptor.
     68 * @ thread_xp  : extended pointer on the remote thread descriptor.
    6569 ***************************************************************************************/
    66 void hal_cpu_context_display( struct thread_s * thread );
     70void hal_cpu_context_fork( xptr_t    thread_xp );
     71
     72/****************************************************************************************
     73 * 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 :
     79 ****************************************************************************************
     80 * @ thread_xp  : extended pointer on the thread descriptor.
     81 ***************************************************************************************/
     82void hal_cpu_context_display( xptr_t  thread_xp );
    6783
    6884/****************************************************************************************
     
    106122
    107123/****************************************************************************************
    108  * This function saves in the thread uzone the FPU registers values.
     124 * This function is used to implement the fork() system call.
     125 * It saves in a remote thread FPU context the current FPU registers values.
    109126 ****************************************************************************************
    110  * @ thread  : pointer on the thread descriptor.
     127 * @ thread_xp  : extended pointer on the remote thread descriptor.
    111128 ***************************************************************************************/
    112 void hal_fpu_context_save( struct thread_s * thread );
     129void hal_fpu_context_save( xptr_t thread_xp );
    113130
    114131/****************************************************************************************
    115  * This function restores from the thread uzone the FPU registers values.
     132 * This function restores from the calling thread FPU context the FPU registers values.
    116133 ****************************************************************************************
    117134 * @ thread  : pointer on the thread descriptor.
Note: See TracChangeset for help on using the changeset viewer.