Changes in kernel/generic/src/mm/page.c [235e6c7:6645a14] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
r235e6c7 r6645a14 53 53 * We assume that the other processors are either not using the mapping yet 54 54 * (i.e. during the bootstrap) or are executing the TLB shootdown code. While 55 * we don't care much about the former case, the processors in the latter case 55 * we don't care much about the former case, the processors in the latter case 56 56 * will do an implicit serialization by virtue of running the TLB shootdown 57 57 * interrupt handler. … … 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> 76 #include <align.h> 72 77 73 78 /** Virtual operations for page subsystem. */ … … 172 177 } 173 178 179 int page_find_mapping(uintptr_t virt, void **phys) 180 { 181 mutex_lock(&AS->lock); 182 183 pte_t *pte = page_mapping_find(AS, virt, false); 184 if ((!PTE_VALID(pte)) || (!PTE_PRESENT(pte))) { 185 mutex_unlock(&AS->lock); 186 return ENOENT; 187 } 188 189 *phys = (void *) PTE_GET_FRAME(pte) + 190 (virt - ALIGN_DOWN(virt, PAGE_SIZE)); 191 192 mutex_unlock(&AS->lock); 193 194 return EOK; 195 } 196 197 /** Syscall wrapper for getting mapping of a virtual page. 198 * 199 * @return EOK on success. 200 * @return ENOENT if no virtual address mapping found. 201 * 202 */ 203 sysarg_t sys_page_find_mapping(uintptr_t virt, void *phys_ptr) 204 { 205 void *phys; 206 int rc = page_find_mapping(virt, &phys); 207 if (rc != EOK) 208 return rc; 209 210 rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys)); 211 return (sysarg_t) rc; 212 } 213 174 214 /** @} 175 215 */
Note:
See TracChangeset
for help on using the changeset viewer.