Changeset 440 for trunk/kernel/mm/vmm.h


Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (4 years ago)
Author:
alain
Message:

1/ Fix a bug in the Multithreaded "sort" applicationr:
The pthread_create() arguments must be declared as global variables.
2/ The exit syscall can be called by any thread of a process..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/vmm.h

    r437 r440  
    293293
    294294/*********************************************************************************************
    295  * This function allocates physical memory from the local cluster to map all PTEs
    296  * of a "kernel" vseg (type KCODE , KDATA, or KDEV) in the page table of process_zero.
    297  * WARNING : It should not be used for "user" vsegs, that must be mapped using the
    298  * "on-demand-paging" policy.
    299  *********************************************************************************************
    300  * @ vseg     : pointer on the vseg to be mapped.
    301  * @ attr     : GPT attributes to be set for all vseg pages.
    302  * @ returns 0 if success / returns ENOMEM if no memory
    303  ********************************************************************************************/
    304 error_t vmm_map_kernel_vseg( vseg_t           * vseg,
    305                              uint32_t           attr );
    306 
    307 /*********************************************************************************************
    308295 * This function removes a given region (defined by a base address and a size) from
    309296 * the VMM of a given process descriptor. This can modify the number of vsegs:
     
    335322 * @ process   : [in] pointer on process descriptor
    336323 * @ vaddr     : [in] virtual address
    337  * @ vseg      : [out] pointer on found vseg
    338  * @ returns 0 if success / returns -1 if user error.
     324 * @ vseg      : [out] local pointer on local vseg
     325 * @ returns 0 if success / returns -1 if user error (out of segment).
    339326 *********************************************************************************************/
    340327error_t vmm_get_vseg( struct process_s  * process,
     
    343330
    344331/*********************************************************************************************
    345  * This function is called by the generic exception handler when a page-fault event
    346  * has been detected for a given process in a given cluster.
    347  * - If the local cluster is the reference, it call directly the vmm_get_pte() function.
    348  * - If the local cluster is not the reference cluster, it send a RPC_VMM_GET_PTE
    349  *   to the reference cluster to get the missing PTE attributes and PPN,
    350  *   and update the local page table.
    351  *********************************************************************************************
    352  * @ process   : pointer on process descriptor.
    353  * @ vpn       : VPN of the missing PTE.
    354  * @ returns 0 if success / returns ENOMEM if no memory.
     332 * This function is called by the generic exception handler in case of page-fault,
     333 * or copy-on-write event locally detected for a given <vpn> in a given <process>
     334 * as defined by the <is_cow> argument.
     335 * 1) For a Page-Fault:
     336 * - If the local cluster is the reference, or for the STACK and CODE segment types,
     337 *   it call directly the vmm_get_pte() function to access the local VMM.
     338 * - Otherwise, it send a RPC_VMM_GET_PTE to the reference cluster to get the missing
     339 *   PTE attributes and PPN.
     340 * This function check that the missing VPN belongs to a registered vseg, allocates
     341 * a new physical page if required, and updates the local page table.
     342 * 2) For a Copy-On-Write:
     343 * - If no pending fork, it reset the COW flag and set the WRITE flag in the reference
     344 *   GPT entry, and in all the GPT copies.
     345 * - If there is a pending fork, it allocates a new physical page from the cluster defined
     346 *   by the vseg type, copies the old physical page content to the new physical page,
     347 *   and decrements the pending_fork counter in old physical page descriptor.
     348 *********************************************************************************************
     349 * @ process   : pointer on local process descriptor copy.
     350 * @ vpn       : VPN of the missing or faulting PTE.
     351 * @ is_cow    : Copy-On-Write event if true / Page-fault if false.
     352 * @ returns 0 if success / returns ENOMEM if no memory or illegal VPN.
    355353 ********************************************************************************************/
    356354error_t vmm_handle_page_fault( struct process_s * process,
    357                                vpn_t              vpn );
    358 
    359 /*********************************************************************************************
    360  * This function is called by the generic exception handler when a copy-on-write event
    361  * has been detected for a given process in a given cluster.
    362  * It takes the lock protecting the physical page, and test the pending forks counter.
    363  * If no pending fork:
    364  * - it reset the COW flag and set the WRITE flag in the reference GPT entry, and in all
    365  *   the GPT copies
    366 
    367  * If there is a pending forkon the
    368  * - It get the involved vseg pointer.
    369  * - It allocates a new physical page from the cluster defined by the vseg type.
    370  * - It copies the old physical page content to the new physical page.
    371  * - It decrements the pending_fork counter in old physical page descriptor.
    372 
    373  *********************************************************************************************
    374  * @ process   : pointer on process descriptor.
    375  * @ vpn       : VPN of the missing PTE.
    376  * @ returns 0 if success / returns ENOMEM if no memory.
    377  ********************************************************************************************/
    378 error_t vmm_handle_cow( struct process_s * process,
    379                         vpn_t              vpn );
    380 
    381 /*********************************************************************************************
    382  * This function handle both the "page-fault" and "copy-on_write" events for a given <vpn>
    383  * in a given <process>.  The <cow> argument defines the type of event to be handled.
    384  * This function must be called by a thread running in reference cluster, and the vseg
    385  * containing the searched VPN must be registered in the reference VMM.
     355                               vpn_t              vpn,
     356                               bool_t             is_cow );
     357
     358/*********************************************************************************************
     359 * This function is called by the vmm_handle_page_fault() to handle both the "page-fault",
     360 * and the "copy-on_write" events for a given <vpn> in a given <process>, as defined
     361 * by the <is_cow> argument.
     362 * The vseg containing the searched VPN must be registered in the reference VMM.
    386363 * - for an page-fault, it allocates the missing physical page from the target cluster
    387364 *   defined by the vseg type, initializes it, and updates the reference GPT, but not
     
    390367 *   initialise it from the old physical page, and updates the reference GPT and all
    391368 *   the GPT copies, for coherence.
    392  * In both cases, it calls the RPC_PMEM_GET_PAGES to get the new physical page when
    393  * the target cluster is not the reference cluster.
     369 * It calls the RPC_PMEM_GET_PAGES to get the new physical page when the target cluster
     370 * is not the local cluster,
    394371 * It returns in the <attr> and <ppn> arguments the accessed or modified PTE.
    395372 *********************************************************************************************
    396373 * @ process   : [in] pointer on process descriptor.
    397374 * @ vpn       : [in] VPN defining the missing PTE.
    398  * @ cow       : [in] "copy_on_write" if true / "page_fault" if false.
     375 * @ is_cow    : [in] "copy_on_write" if true / "page_fault" if false.
    399376 * @ attr      : [out] PTE attributes.
    400377 * @ ppn       : [out] PTE ppn.
     
    403380error_t vmm_get_pte( struct process_s * process,
    404381                     vpn_t              vpn,
    405                      bool_t             cow,
     382                     bool_t             is_cow,
    406383                     uint32_t         * attr,
    407384                     ppn_t            * ppn );
     
    428405                         ppn_t  * ppn );
    429406
    430 /*********************************************************************************************
    431  * This function makes the virtual to physical address translation, using the calling
    432  * process page table. It uses identity mapping if required by the <ident> argument.
    433  * This address translation is required to configure the peripherals having a DMA
    434  * capability, or to implement the software L2/L3 cache cohérence, using the MMC device
    435  * synchronisation primitives.
    436  * WARNING : the <ident> value must be defined by the CONFIG_KERNEL_IDENTITY_MAP parameter.
    437  *********************************************************************************************
    438  * @ ident     : [in] uses identity mapping if true.
    439  * @ ptr       : [in] virtual address.
    440  * @ paddr     : [out] pointer on buffer for physical address.
    441  * @ returns 0 if success / returns ENOMEM if error.
    442  ********************************************************************************************/
    443 error_t vmm_v2p_translate( bool_t    ident,
    444                            void    * ptr,
    445                            paddr_t * paddr );
    446 
    447 
    448407
    449408#endif /* _VMM_H_ */
Note: See TracChangeset for help on using the changeset viewer.