Changeset a33f0a6 in mainline for kernel/generic/src/mm/page.c
- Timestamp:
- 2011-08-03T17:34:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1940326
- Parents:
- 52a79081 (diff), 3fab770 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
r52a79081 ra33f0a6 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 ich page belongs.114 * @param as Address space to which 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 ich page belongs.141 * @param as Address space to which 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 * Find mapping for virtual page. 157 * 158 * @param as Address space to wich page belongs. 159 * @param page Virtual page. 158 /** Find mapping for virtual page. 159 * 160 * @param as Address space to which page belongs. 161 * @param page Virtual page. 162 * @param nolock True if the page tables need not be locked. 160 163 * 161 164 * @return NULL if there is no such mapping; requested mapping … … 163 166 * 164 167 */ 165 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page )166 { 167 ASSERT( page_table_locked(as));168 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page, bool nolock) 169 { 170 ASSERT(nolock || page_table_locked(as)); 168 171 169 172 ASSERT(page_mapping_operations); 170 173 ASSERT(page_mapping_operations->mapping_find); 171 174 172 return page_mapping_operations->mapping_find(as, page); 175 return page_mapping_operations->mapping_find(as, page, nolock); 176 } 177 178 /** Syscall wrapper for getting mapping of a virtual page. 179 * 180 * @retval EOK Everything went find, @p uspace_frame and @p uspace_node 181 * contains correct values. 182 * @retval ENOENT Virtual address has no mapping. 183 */ 184 sysarg_t sys_page_find_mapping(uintptr_t virt_address, 185 uintptr_t *uspace_frame) 186 { 187 mutex_lock(&AS->lock); 188 189 pte_t *pte = page_mapping_find(AS, virt_address, false); 190 if (!PTE_VALID(pte) || !PTE_PRESENT(pte)) { 191 mutex_unlock(&AS->lock); 192 193 return (sysarg_t) ENOENT; 194 } 195 196 uintptr_t phys_address = PTE_GET_FRAME(pte); 197 198 mutex_unlock(&AS->lock); 199 200 int rc = copy_to_uspace(uspace_frame, 201 &phys_address, sizeof(phys_address)); 202 if (rc != EOK) { 203 return (sysarg_t) rc; 204 } 205 206 return EOK; 173 207 } 174 208
Note:
See TracChangeset
for help on using the changeset viewer.