Changes in kernel/generic/src/mm/page.c [235e6c7:b93d637] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
r235e6c7 rb93d637 60 60 61 61 #include <mm/page.h> 62 #include <genarch/mm/page_ht.h> 63 #include <genarch/mm/page_pt.h> 62 64 #include <arch/mm/page.h> 63 65 #include <arch/mm/asid.h> … … 70 72 #include <debug.h> 71 73 #include <arch.h> 74 #include <syscall/copy.h> 75 #include <errno.h> 72 76 73 77 /** Virtual operations for page subsystem. */ … … 108 112 * using flags. Allocate and setup any missing page tables. 109 113 * 110 * @param as Address space to w hich page belongs.114 * @param as Address space to wich page belongs. 111 115 * @param page Virtual address of the page to be mapped. 112 116 * @param frame Physical address of memory frame to which the mapping is … … 135 139 * this call visible. 136 140 * 137 * @param as Address space to w hich page belongs.141 * @param as Address space to wich page belongs. 138 142 * @param page Virtual address of the page to be demapped. 139 143 * … … 152 156 } 153 157 154 /** Find mapping for virtual page. 155 * 156 * @param as Address space to which page belongs. 157 * @param page Virtual page. 158 * @param nolock True if the page tables need not be locked. 158 /** Find mapping for virtual page 159 * 160 * Find mapping for virtual page. 161 * 162 * @param as Address space to wich page belongs. 163 * @param page Virtual page. 159 164 * 160 165 * @return NULL if there is no such mapping; requested mapping … … 162 167 * 163 168 */ 164 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page , bool nolock)165 { 166 ASSERT( nolock ||page_table_locked(as));169 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page) 170 { 171 ASSERT(page_table_locked(as)); 167 172 168 173 ASSERT(page_mapping_operations); 169 174 ASSERT(page_mapping_operations->mapping_find); 170 175 171 return page_mapping_operations->mapping_find(as, page, nolock); 176 return page_mapping_operations->mapping_find(as, page); 177 } 178 179 /** Syscall wrapper for getting mapping of a virtual page. 180 * 181 * @retval EOK Everything went find, @p uspace_frame and @p uspace_node 182 * contains correct values. 183 * @retval ENOENT Virtual address has no mapping. 184 */ 185 sysarg_t sys_page_find_mapping(uintptr_t virt_address, 186 uintptr_t *uspace_frame) 187 { 188 mutex_lock(&AS->lock); 189 190 pte_t *pte = page_mapping_find(AS, virt_address); 191 if (!PTE_VALID(pte) || !PTE_PRESENT(pte)) { 192 mutex_unlock(&AS->lock); 193 194 return (sysarg_t) ENOENT; 195 } 196 197 uintptr_t phys_address = PTE_GET_FRAME(pte); 198 199 mutex_unlock(&AS->lock); 200 201 int rc = copy_to_uspace(uspace_frame, 202 &phys_address, sizeof(phys_address)); 203 if (rc != EOK) { 204 return (sysarg_t) rc; 205 } 206 207 return EOK; 172 208 } 173 209
Note:
See TracChangeset
for help on using the changeset viewer.