Changes in kernel/generic/src/ddi/ddi.c [f430f58:a422bc5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/ddi.c
rf430f58 ra422bc5 46 46 #include <mm/frame.h> 47 47 #include <mm/as.h> 48 #include <synch/ spinlock.h>48 #include <synch/mutex.h> 49 49 #include <syscall/copy.h> 50 50 #include <adt/btree.h> … … 54 54 55 55 /** This lock protects the parea_btree. */ 56 SPINLOCK_INITIALIZE(parea_lock);56 static mutex_t parea_lock; 57 57 58 58 /** B+tree with enabled physical memory areas. */ … … 63 63 { 64 64 btree_create(&parea_btree); 65 mutex_initialize(&parea_lock, MUTEX_PASSIVE); 65 66 } 66 67 … … 72 73 void ddi_parea_register(parea_t *parea) 73 74 { 74 ipl_t ipl = interrupts_disable(); 75 spinlock_lock(&parea_lock); 75 mutex_lock(&parea_lock); 76 76 77 77 /* … … 80 80 btree_insert(&parea_btree, (btree_key_t) parea->pbase, parea, NULL); 81 81 82 spinlock_unlock(&parea_lock); 83 interrupts_restore(ipl); 82 mutex_unlock(&parea_lock); 84 83 } 85 84 … … 141 140 spinlock_unlock(&zones.lock); 142 141 143 spinlock_lock(&parea_lock);142 mutex_lock(&parea_lock); 144 143 btree_node_t *nodep; 145 144 parea_t *parea = (parea_t *) btree_search(&parea_btree, … … 147 146 148 147 if ((!parea) || (parea->frames < pages)) { 149 spinlock_unlock(&parea_lock);148 mutex_unlock(&parea_lock); 150 149 goto err; 151 150 } 152 151 153 spinlock_unlock(&parea_lock);152 mutex_unlock(&parea_lock); 154 153 goto map; 155 154 } … … 161 160 162 161 map: 163 spinlock_lock(&TASK->lock);164 162 interrupts_restore(ipl); 163 165 164 if (!as_area_create(TASK->as, flags, pages * PAGE_SIZE, vp, 166 165 AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) { … … 169 168 * We report it using ENOMEM. 170 169 */ 171 spinlock_unlock(&TASK->lock);172 interrupts_restore(ipl);173 170 return ENOMEM; 174 171 } … … 177 174 * Mapping is created on-demand during page fault. 178 175 */ 179 180 spinlock_unlock(&TASK->lock);181 interrupts_restore(ipl);182 176 return 0; 183 177 }
Note:
See TracChangeset
for help on using the changeset viewer.