Ignore:
Timestamp:
Apr 10, 2019, 10:09:39 AM (2 years ago)
Author:
alain
Message:

Fix a bug in the vmm_remove_vseg() function: the physical pages
associated to an user DATA vseg were released to the kernel when
the target process descriptor was in the reference cluster.
This physical pages release should be done only when the page
forks counter value is zero.
All other modifications are cosmetic.

File:
1 edited

Legend:

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

    r457 r625  
    22 * hal_context.h - Generic Thread Context Access API definition.
    33 *
    4  * Author  Alain Greiner    (2016)
     4 * Author  Alain Greiner    (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    3131// and hal_fpu_context_t, defined in hal_context.c file, that are accessed with generic
    3232// void* pointers stored in the thread descriptor.
    33 // - the "hal_context_t" struct is used for the CPU registers values at context switch.
    34 // - the "hal_fpu_context_t" struct is used for the FPU registers when required.
     33// - the "hal_cpu_context_t" struct saves the CPU registers values at context switch.
     34// - the "hal_fpu_context_t" struct saves the FPU registers values at FPU switch.
    3535//////////////////////////////////////////////////////////////////////////////////////////
    3636
     
    5656
    5757/****************************************************************************************
    58  * This function is used to implement the fork() system call.
    59  * 1) It saves in a remote (child) thread CPU context the current CPU registers values.
    60  *    Three slots are not simple copies of the parent registers values :
    61  *    - the thread pointer is set to the child thread local pointer.
    62  *    - the stack pointer is set to parrent SP + (child_base - parent_base).
    63  *    - the status register is set to kernel mode with IRQ disabled.
    64  * 2) It copies the content of the calling (parent) thread kernel_stack,
    65  *    to the remote (child) thread kernel_stack.
     58 * This function is called the sys_fork() function to complete the fork mechanism.
     59 * It is called by th local parent thread to initialize the CPU context of the remote
     60 * child thread, identified by the <thread_xp> argument.
     61 * It makes three actions:
     62 * 1) It copies the current values of the CPU registers of the core running the parent
     63 *    thread to the remote child CPU context.
     64 * 2) It patches four slots of this remote child CPU context:
     65 *    - the c0_th   slot is set to the child thread descriptor pointer.
     66 *    - the sp_29   slot is set to the child kernel stack pointer.
     67 *    - the c0_sr   slot is set to kernel mode with IRQ disabled.
     68 *    - the c2_ptpr slot is set to the child process GPT value.
     69 * 3) It copies the content of the parent thread kernel_stack, to the child thread
     70 *    kernel_stack, because the COW mechanism is not available on architectures where
     71 *    the data MMU is de-activated in kernel mode.
    6672 ****************************************************************************************
    67  * @ thread_xp  : extended pointer on the remote thread descriptor.
     73 * @ thread_xp  : extended pointer on the child thread descriptor.
    6874 ***************************************************************************************/
    6975void hal_cpu_context_fork( xptr_t    thread_xp );
Note: See TracChangeset for help on using the changeset viewer.