Changeset 407 for trunk/hal/generic/hal_gpt.h
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_gpt.h
r406 r407 43 43 44 44 struct page_s; 45 struct process_s; 45 46 46 47 /**************************************************************************************** … … 48 49 ***************************************************************************************/ 49 50 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 */ 63 64 64 65 /**************************************************************************************** … … 70 71 void * ptr; /*! local pointer on GPT root */ 71 72 ppn_t ppn; /*! PPN of GPT root */ 72 struct page_s * page; /*! local pointer on GPT root page descriptor */73 73 } 74 74 gpt_t; … … 98 98 * This function prints on the kernel terminal the content of a generic page table. 99 99 **************************************************************************************** 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 ***************************************************************************************/ 102 void hal_gpt_display( struct process_s * process ); 105 103 106 104 /**************************************************************************************** … … 169 167 170 168 /**************************************************************************************** 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). 176 176 **************************************************************************************** 177 177 * @ dst_gpt : [in] pointer on the destination GPT. 178 178 * @ 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. 179 181 * @ cow : [in] activate the COPY-On-Write mechanism if true. 180 182 ***************************************************************************************/ 181 183 error_t hal_gpt_copy( gpt_t * dst_gpt, 182 184 gpt_t * src_gpt, 185 vpn_t vpn_base, 186 vpn_t vpn_size, 183 187 bool_t cow ); 184 188 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 ***************************************************************************************/ 196 bool_t hal_gpt_pte_is_cow( gpt_t * gpt, 197 vpn_t vpn ); 198 185 199 186 200 #endif /* _GPT_H_ */
Note: See TracChangeset
for help on using the changeset viewer.