Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (5 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

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

    r406 r407  
    4343
    4444struct page_s;
     45struct process_s;
    4546
    4647/****************************************************************************************
     
    4849 ***************************************************************************************/
    4950
    50 #define GPT_MAPPED      0x0001  /*! PTE is mapped                                 */
    51 #define GPT_SMALL       0x0002  /*! PTE is a small page                           */
    52 #define GPT_READABLE    0x0004  /*! PTE is readable                               */
    53 #define GPT_WRITABLE    0x0008  /*! PTE is writable                               */
    54 #define GPT_EXECUTABLE  0x0010  /*! PTE is executable                             */
    55 #define GPT_CACHABLE    0x0020  /*! PTE can be cached                             */
    56 #define GPT_USER        0x0040  /*! PTE is user accessible                        */
    57 #define GPT_DIRTY       0x0080  /*! PTE has been "recently" written               */
    58 #define GPT_ACCESSED    0x0100  /*! PTE has been "recently" accessed              */
    59 #define GPT_GLOBAL      0x0200  /*! PTE is kept in TLB at context switch          */
    60 #define GPT_COW         0x0400  /*! PTE must be copied on write                   */
    61 #define GPT_SWAP        0x0800  /*! PTE swapped on disk (not implemented yet)     */
    62 #define GPT_LOCKED      0x1000  /*! PTE is protected against concurrent access    */
     51#define GPT_MAPPED      0x0001       /*! PTE is mapped                                 */
     52#define GPT_SMALL       0x0002       /*! PTE is a small page                           */
     53#define GPT_READABLE    0x0004       /*! PTE is readable                               */
     54#define GPT_WRITABLE    0x0008       /*! PTE is writable                               */
     55#define GPT_EXECUTABLE  0x0010       /*! PTE is executable                             */
     56#define GPT_CACHABLE    0x0020       /*! PTE can be cached                             */
     57#define GPT_USER        0x0040       /*! PTE is user accessible                        */
     58#define GPT_DIRTY       0x0080       /*! PTE has been "recently" written               */
     59#define GPT_ACCESSED    0x0100       /*! PTE has been "recently" accessed              */
     60#define GPT_GLOBAL      0x0200       /*! PTE is kept in TLB at context switch          */
     61#define GPT_COW         0x0400       /*! PTE must be copied on write                   */
     62#define GPT_SWAP        0x0800       /*! PTE swapped on disk (not implemented yet)     */
     63#define GPT_LOCKED      0x1000       /*! PTE is protected against concurrent access    */
    6364
    6465/****************************************************************************************
     
    7071        void           * ptr;    /*! local pointer on GPT root                             */
    7172        ppn_t            ppn;    /*! PPN of GPT root                                       */
    72         struct page_s  * page;   /*! local pointer on GPT root page descriptor             */
    7373}
    7474gpt_t;
     
    9898 * This function prints on the kernel terminal the content of a generic page table.
    9999 ****************************************************************************************
    100  * @ gpt     : pointer on generic page table descriptor.
    101  * @ pid     : process identifier.
    102  ***************************************************************************************/
    103 void hal_gpt_print( gpt_t * gpt,
    104                     pid_t   pid );
     100 * @ process : pointer on local process descriptor.
     101 ***************************************************************************************/
     102void hal_gpt_display( struct process_s * process );
    105103
    106104/****************************************************************************************
     
    169167
    170168/****************************************************************************************
    171  * This function copies all valid entries from the source <src_gpt> to the <dst_gpt>.
    172  * The <src_gpt> and the <dst_gpt> point on the same physical pages.
    173  * If the <cow> argument is true, the GPT_WRITABLE attribute is reset for all writable
    174  * entries in both <src_gpt> and <dst_gpt>, and the PG_COW flag is registered in all
    175  * writable physical page descriptors, to support the Copy-On-Write mechanism.
     169 * This function is used to implement the "fork" system call: It copies all valid GPT
     170 * entries for a given vseg identified by the <vpn_base> and <vpn_size> arguments,
     171 * from the source <src_gpt> to the <dst_gpt>.
     172 * It optionnally activates the "Copy on Write" mechanism: when the <cow> argument is
     173 * true, the GPT_WRITABLE flag is reset, and the GPT_COW flag is set for each valid
     174 * entry in the destination GPT (The data page will be dynamically allocated an copied
     175 * when a write access is detected).
    176176 ****************************************************************************************
    177177 * @ dst_gpt   : [in]  pointer on the destination GPT.
    178178 * @ src_gpt   : [in]  pointer on the source GPT.
     179 * @ vpn_base  : [in]  first vpn in vseg.
     180 * @ vpn_size  : [in]  number of pages in vseg.
    179181 * @ cow       : [in]  activate the COPY-On-Write mechanism if true.
    180182 ***************************************************************************************/
    181183error_t hal_gpt_copy( gpt_t    * dst_gpt,
    182184                      gpt_t    * src_gpt,
     185                      vpn_t      vpn_base,
     186                      vpn_t      vpn_size,
    183187                      bool_t     cow );
    184188
     189/****************************************************************************************
     190 * This function returns GPT_COW flag for a PTE defined by <gpt> and <vpn> arguments.
     191 ****************************************************************************************
     192 * @ gpt       : [in]  pointer on the page table
     193 * @ vpn       : [in]  virtual page number
     194 * @ returns true if GPT_COW is set.
     195 ***************************************************************************************/
     196bool_t hal_gpt_pte_is_cow( gpt_t * gpt,
     197                           vpn_t   vpn );
     198
    185199
    186200#endif  /* _GPT_H_ */
Note: See TracChangeset for help on using the changeset viewer.