Changes in kernel/generic/src/ddi/ddi.c [b366a6f4:d7533c7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/ddi.c
rb366a6f4 rd7533c7 122 122 backend_data.frames = pages; 123 123 124 /* 125 * Check if the memory region is explicitly enabled 126 * for mapping by any parea structure. 127 */ 128 129 mutex_lock(&parea_lock); 130 btree_node_t *nodep; 131 parea_t *parea = (parea_t *) btree_search(&parea_btree, 132 (btree_key_t) pf, &nodep); 133 134 if ((parea != NULL) && (parea->frames >= pages)) { 135 if ((!priv) && (!parea->unpriv)) { 136 mutex_unlock(&parea_lock); 137 return EPERM; 138 } 139 140 goto map; 141 } 142 143 parea = NULL; 144 mutex_unlock(&parea_lock); 145 146 /* 147 * Check if the memory region is part of physical 148 * memory generally enabled for mapping. 149 */ 150 124 /* Find the zone of the physical memory */ 151 125 irq_spinlock_lock(&zones.lock, true); 152 126 size_t znum = find_zone(ADDR2PFN(pf), pages, 0); … … 179 153 } 180 154 155 if (zone_flags_available(zones.info[znum].flags)) { 156 /* 157 * Frames are part of physical memory, check 158 * if the memory region is enabled for mapping. 159 */ 160 irq_spinlock_unlock(&zones.lock, true); 161 162 mutex_lock(&parea_lock); 163 btree_node_t *nodep; 164 parea_t *parea = (parea_t *) btree_search(&parea_btree, 165 (btree_key_t) pf, &nodep); 166 167 if ((!parea) || (parea->frames < pages)) { 168 mutex_unlock(&parea_lock); 169 return ENOENT; 170 } 171 172 if (!priv) { 173 if (!parea->unpriv) { 174 mutex_unlock(&parea_lock); 175 return EPERM; 176 } 177 } 178 179 mutex_unlock(&parea_lock); 180 goto map; 181 } 182 181 183 irq_spinlock_unlock(&zones.lock, true); 182 184 return ENOENT; … … 186 188 AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) { 187 189 /* 188 * The address space area was notcreated.190 * The address space area could not have been created. 189 191 * We report it using ENOMEM. 190 192 */ 191 192 if (parea != NULL)193 mutex_unlock(&parea_lock);194 195 193 return ENOMEM; 196 194 } … … 199 197 * Mapping is created on-demand during page fault. 200 198 */ 201 202 if (parea != NULL) { 203 parea->mapped = true; 204 mutex_unlock(&parea_lock); 205 } 206 207 return EOK; 199 return 0; 208 200 } 209 201 … … 232 224 task_t *task = task_find_by_id(id); 233 225 234 if ((!task) || (!cont ainer_check(CONTAINER, task->container))) {226 if ((!task) || (!context_check(CONTEXT, task->context))) { 235 227 /* 236 228 * There is no task with the specified ID
Note:
See TracChangeset
for help on using the changeset viewer.