Changeset 17 for trunk/hal/generic/hal_gpt.h
- Timestamp:
- May 11, 2017, 7:49:17 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_gpt.h
r16 r17 30 30 // Generic Page Table Definition (implementation in hal_gpt.c) 31 31 // 32 // It is specified as a simple (one dimension nal) array indexed by the VPN (vpn_t type),33 // even if implementations can use a more sophisticated organis tion (two-levels or more).34 // - The number of entries (number of pages in a virtual space) is architecture 35 // depend ant, and is defined as (CONFIG_USER_SPACE_SIZE / CONFIG_PPM_PAGE_SIZE).36 // - Each entry contains a Physical Page Number (ppn_t type), 32 // It is specified as a simple (one dimensional) array indexed by the VPN (vpn_t type), 33 // even if implementations can use a more sophisticated organisation (two-levels or more). 34 // - The number of entries (number of pages in a virtual space) is architecture 35 // dependent, and is defined as (CONFIG_USER_SPACE_SIZE / CONFIG_PPM_PAGE_SIZE). 36 // - Each entry contains a Physical Page Number (ppn_t type), and a set of attributes, 37 37 // defined as masks on a 32 bits-vector. 38 38 // 39 // Any arch-specific implementation must implement this API. 39 // Any arch-specific implementation must implement this API. 40 40 ///////////////////////////////////////////////////////////////////////////////////////// 41 41 … … 71 71 void * ptr; /*! pointer on GPT root (must be page aligned) */ 72 72 ppn_t ppn; /*! PPN of GPT root */ 73 73 struct page_s * page; /*! pointer on page descriptor for GPT root */ 74 74 } 75 75 gpt_t; … … 78 78 /**************************************************************************************** 79 79 * This function allocates physical memory for first level page table (PT1), 80 * and initialize the page table descriptor.80 * and initializes the page table descriptor. 81 81 **************************************************************************************** 82 82 * @ gpt : pointer on generic page table descriptor. … … 88 88 * This function releases all memory dynamically allocated for a generic page table. 89 89 * For a multi-levels radix tree implementation, it includes all nodes in the tree. 90 * If the calling thread is running in the reference cluster, it checks that user PTE 90 * If the calling thread is running in the reference cluster, it checks that user PTE 91 91 * entries are unmapped, and release the mapped physical pages. 92 92 * The kernel pages are not released. … … 104 104 105 105 /**************************************************************************************** 106 * This blocking f onction geta lock on a PTE (page Table Entry) identified106 * This blocking function gets a lock on a PTE (page Table Entry) identified 107 107 * by its VPN, and returns only when the PTE has been successfully locked. 108 * If the target PTE is not present, it allocates and map a physical page.108 * If the target PTE is not present, it allocates and maps a physical page. 109 109 * A big page cannot be locked. 110 110 **************************************************************************************** 111 * @ gpt : pointer on the generic page table 111 * @ gpt : pointer on the generic page table 112 112 * @ vpn : virtual page number of the target PTE. 113 * @ returns 0 if success / return ENOMEM or EINVAL if error. 113 * @ returns 0 if success / return ENOMEM or EINVAL if error. 114 114 ***************************************************************************************/ 115 115 error_t hal_gpt_lock_pte( gpt_t * gpt, … … 119 119 * This function releases the lock on a PTE identified by its VPN. 120 120 **************************************************************************************** 121 * @ gpt : pointer on the generic page table 121 * @ gpt : pointer on the generic page table 122 122 * @ vpn : virtual page number of the target PTE. 123 * @ returns 0 if success / returns EINVAL if error. 123 * @ returns 0 if success / returns EINVAL if error. 124 124 ***************************************************************************************/ 125 error_t hal_gpt_unlock_pte( gpt_t * gpt, 126 vpn_t vpn ); 125 error_t hal_gpt_unlock_pte( gpt_t * gpt, 126 vpn_t vpn ); 127 127 128 128 /**************************************************************************************** 129 * This function map a page table entry identified by its VPN, from values defined129 * This function maps a page table entry identified by its VPN, from values defined 130 130 * by the ppn and attr arguments. It allocates physical memory for the local generic 131 131 * page table itself if required. … … 133 133 * @ gpt : [in] pointer on the page table 134 134 * @ vpn : [in] virtual page number 135 * @ ppn : [in] physical page number 135 * @ ppn : [in] physical page number 136 136 * @ attr : [in] generic attributes 137 137 * @ returns 0 if success / returns ENOMEM if error … … 143 143 144 144 /**************************************************************************************** 145 * This function unmap a page table entry identified by its VPN.146 * If the calling thread is running in the reference cluster, it send a broadcast RPC147 * to update all other spage table copies.145 * This function unmaps a page table entry identified by its VPN. 146 * If the calling thread is running in the reference cluster, it sends a broadcast RPC 147 * to update all other page table copies. 148 148 **************************************************************************************** 149 149 * @ gpt : [in] pointer on the page table … … 160 160 * @ vpn : [in] virtual page number 161 161 * @ attr : [out] generic attributes 162 * @ ppn : [out] physical page number 162 * @ ppn : [out] physical page number 163 163 ***************************************************************************************/ 164 164 void hal_gpt_get_pte( gpt_t * gpt, … … 166 166 uint32_t * attr, 167 167 ppn_t * ppn ); 168 168 169 169 170 170 #endif /* _GPT_H_ */
Note: See TracChangeset
for help on using the changeset viewer.