Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/mm/as_ht.c

    r08a19ba rada559c  
    3030 * @{
    3131 */
    32  
     32
    3333/**
    3434 * @file
    35  * @brief       Address space functions for global page hash table.
     35 * @brief Address space functions for global page hash table.
    3636 */
    3737
     
    4141#include <mm/as.h>
    4242#include <mm/frame.h>
    43 #include <arch/types.h>
     43#include <typedefs.h>
    4444#include <memstr.h>
    4545#include <adt/hash_table.h>
    4646#include <synch/mutex.h>
    4747
    48 static pte_t *ht_create(int flags);
    49 static void ht_destroy(pte_t *page_table);
     48static pte_t *ht_create(unsigned int);
     49static void ht_destroy(pte_t *);
    5050
    51 static void ht_lock(as_t *as, bool lock);
    52 static void ht_unlock(as_t *as, bool unlock);
     51static void ht_lock(as_t *, bool);
     52static void ht_unlock(as_t *, bool);
     53static bool ht_locked(as_t *);
    5354
    5455as_operations_t as_ht_operations = {
     
    5758        .page_table_lock = ht_lock,
    5859        .page_table_unlock = ht_unlock,
     60        .page_table_locked = ht_locked,
    5961};
    6062
     
    6870 *
    6971 * @return Returns NULL.
     72 *
    7073 */
    71 pte_t *ht_create(int flags)
     74pte_t *ht_create(unsigned int flags)
    7275{
    7376        if (flags & FLAG_AS_KERNEL) {
     
    7578                mutex_initialize(&page_ht_lock, MUTEX_PASSIVE);
    7679        }
     80       
    7781        return NULL;
    7882}
     
    8387 *
    8488 * @param page_table This parameter is ignored.
     89 *
    8590 */
    8691void ht_destroy(pte_t *page_table)
     
    9499 * Interrupts must be disabled.
    95100 *
    96  * @param as Address space.
     101 * @param as   Address space.
    97102 * @param lock If false, do not attempt to lock the address space.
     103 *
    98104 */
    99105void ht_lock(as_t *as, bool lock)
     
    101107        if (lock)
    102108                mutex_lock(&as->lock);
     109       
    103110        mutex_lock(&page_ht_lock);
    104111}
     
    109116 * Interrupts must be disabled.
    110117 *
    111  * @param as Address space.
     118 * @param as     Address space.
    112119 * @param unlock If false, do not attempt to lock the address space.
     120 *
    113121 */
    114122void ht_unlock(as_t *as, bool unlock)
    115123{
    116124        mutex_unlock(&page_ht_lock);
     125       
    117126        if (unlock)
    118127                mutex_unlock(&as->lock);
    119128}
    120129
     130/** Test whether page tables are locked.
     131 *
     132 * @param as            Address space where the page tables belong.
     133 *
     134 * @return              True if the page tables belonging to the address soace
     135 *                      are locked, otherwise false.
     136 */
     137bool ht_locked(as_t *as)
     138{
     139        return (mutex_locked(&page_ht_lock) && mutex_locked(&as->lock));
     140}
     141
    121142/** @}
    122143 */
Note: See TracChangeset for help on using the changeset viewer.