Changeset 373acb4 in mainline


Ignore:
Timestamp:
2010-04-28T20:08:27Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a422bc5
Parents:
c6218327
Message:

Replace the parea_lock spinlock with mutex and don't insist on interrupts being disabled when taking it.

File:
1 edited

Legend:

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

    rc6218327 r373acb4  
    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        }
Note: See TracChangeset for help on using the changeset viewer.