Changeset d5bd8d7 in mainline for kernel/generic/src/mm/backend_anon.c
- Timestamp:
- 2007-03-25T13:02:06Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4638401
- Parents:
- 0f6a3376
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/backend_anon.c
r0f6a3376 rd5bd8d7 73 73 * @param access Access mode that caused the fault (i.e. read/write/exec). 74 74 * 75 * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e. serviced). 75 * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e. 76 * serviced). 76 77 */ 77 78 int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access) … … 87 88 /* 88 89 * The area is shared, chances are that the mapping can be found 89 * in the pagemap of the address space area share info structure. 90 * in the pagemap of the address space area share info 91 * structure. 90 92 * In the case that the pagemap does not contain the respective 91 93 * mapping, a new frame is allocated and the mapping is created. … … 103 105 */ 104 106 for (i = 0; i < leaf->keys; i++) { 105 if (leaf->key[i] == ALIGN_DOWN(addr, PAGE_SIZE)) { 107 if (leaf->key[i] == 108 ALIGN_DOWN(addr, PAGE_SIZE)) { 106 109 allocate = false; 107 110 break; … … 113 116 114 117 /* 115 * Insert the address of the newly allocated frame to the pagemap. 118 * Insert the address of the newly allocated 119 * frame to the pagemap. 116 120 */ 117 btree_insert(&area->sh_info->pagemap, ALIGN_DOWN(addr, PAGE_SIZE) - area->base, (void *) frame, leaf); 121 btree_insert(&area->sh_info->pagemap, 122 ALIGN_DOWN(addr, PAGE_SIZE) - area->base, 123 (void *) frame, leaf); 118 124 } 119 125 } … … 142 148 /* 143 149 * Map 'page' to 'frame'. 144 * Note that TLB shootdown is not attempted as only new information is being145 * inserted into page tables.150 * Note that TLB shootdown is not attempted as only new information is 151 * being inserted into page tables. 146 152 */ 147 153 page_mapping_insert(AS, addr, frame, as_area_get_flags(area)); … … 185 191 */ 186 192 mutex_lock(&area->sh_info->lock); 187 for (cur = area->used_space.leaf_head.next; cur != &area->used_space.leaf_head; cur = cur->next) { 193 for (cur = area->used_space.leaf_head.next; 194 cur != &area->used_space.leaf_head; cur = cur->next) { 188 195 btree_node_t *node; 189 196 int i; … … 199 206 200 207 page_table_lock(area->as, false); 201 pte = page_mapping_find(area->as, base + j*PAGE_SIZE); 202 ASSERT(pte && PTE_VALID(pte) && PTE_PRESENT(pte)); 203 btree_insert(&area->sh_info->pagemap, (base + j*PAGE_SIZE) - area->base, 204 (void *) PTE_GET_FRAME(pte), NULL); 208 pte = page_mapping_find(area->as, 209 base + j * PAGE_SIZE); 210 ASSERT(pte && PTE_VALID(pte) && 211 PTE_PRESENT(pte)); 212 btree_insert(&area->sh_info->pagemap, 213 (base + j * PAGE_SIZE) - area->base, 214 (void *) PTE_GET_FRAME(pte), NULL); 205 215 page_table_unlock(area->as, false); 206 frame_reference_add(ADDR2PFN(PTE_GET_FRAME(pte))); 216 217 pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(pte)); 218 frame_reference_add(pfn); 207 219 } 208 220 … … 214 226 /** @} 215 227 */ 228
Note:
See TracChangeset
for help on using the changeset viewer.