Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 25a76ab8 in mainline for kernel/generic/src/ddi/ddi.c


Ignore:
Timestamp:
2010-05-08T07:53:23Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
051bc69a
Parents:
6c39a907 (diff), 1317380 (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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ddi/ddi.c

    r6c39a907 r25a76ab8  
    4646#include <mm/frame.h>
    4747#include <mm/as.h>
    48 #include <synch/spinlock.h>
     48#include <synch/mutex.h>
    4949#include <syscall/copy.h>
    5050#include <adt/btree.h>
     
    5454
    5555/** This lock protects the parea_btree. */
    56 SPINLOCK_INITIALIZE(parea_lock);
     56static mutex_t parea_lock;
    5757
    5858/** B+tree with enabled physical memory areas. */
     
    6363{
    6464        btree_create(&parea_btree);
     65        mutex_initialize(&parea_lock, MUTEX_PASSIVE);
    6566}
    6667
     
    7273void ddi_parea_register(parea_t *parea)
    7374{
    74         ipl_t ipl = interrupts_disable();
    75         spinlock_lock(&parea_lock);
     75        mutex_lock(&parea_lock);
    7676       
    7777        /*
     
    8080        btree_insert(&parea_btree, (btree_key_t) parea->pbase, parea, NULL);
    8181       
    82         spinlock_unlock(&parea_lock);
    83         interrupts_restore(ipl);
     82        mutex_unlock(&parea_lock);
    8483}
    8584
     
    141140                spinlock_unlock(&zones.lock);
    142141               
    143                 spinlock_lock(&parea_lock);
     142                mutex_lock(&parea_lock);
    144143                btree_node_t *nodep;
    145144                parea_t *parea = (parea_t *) btree_search(&parea_btree,
     
    147146               
    148147                if ((!parea) || (parea->frames < pages)) {
    149                         spinlock_unlock(&parea_lock);
     148                        mutex_unlock(&parea_lock);
    150149                        goto err;
    151150                }
    152151               
    153                 spinlock_unlock(&parea_lock);
     152                mutex_unlock(&parea_lock);
    154153                goto map;
    155154        }
     
    161160       
    162161map:
    163         spinlock_lock(&TASK->lock);
    164        
     162        interrupts_restore(ipl);
     163
    165164        if (!as_area_create(TASK->as, flags, pages * PAGE_SIZE, vp,
    166165            AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) {
     
    169168                 * We report it using ENOMEM.
    170169                 */
    171                 spinlock_unlock(&TASK->lock);
    172                 interrupts_restore(ipl);
    173170                return ENOMEM;
    174171        }
     
    177174         * Mapping is created on-demand during page fault.
    178175         */
    179        
    180         spinlock_unlock(&TASK->lock);
    181         interrupts_restore(ipl);
    182176        return 0;
    183177}
Note: See TracChangeset for help on using the changeset viewer.