Subversion Repositories HelenOS

Rev

Rev 3386 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3386 Rev 4581
Line 49... Line 49...
49
#include <debug.h>
49
#include <debug.h>
50
#include <memstr.h>
50
#include <memstr.h>
51
#include <adt/hash_table.h>
51
#include <adt/hash_table.h>
52
#include <align.h>
52
#include <align.h>
53
 
53
 
54
static index_t hash(unative_t key[]);
54
static size_t hash(unative_t key[]);
55
static bool compare(unative_t key[], count_t keys, link_t *item);
55
static bool compare(unative_t key[], size_t keys, link_t *item);
56
static void remove_callback(link_t *item);
56
static void remove_callback(link_t *item);
57
 
57
 
58
static void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame,
58
static void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame,
59
    int flags);
59
    int flags);
60
static void ht_mapping_remove(as_t *as, uintptr_t page);
60
static void ht_mapping_remove(as_t *as, uintptr_t page);
Line 91... Line 91...
91
 *
91
 *
92
 * @param key Array of two keys (i.e. page and address space).
92
 * @param key Array of two keys (i.e. page and address space).
93
 *
93
 *
94
 * @return Index into page hash table.
94
 * @return Index into page hash table.
95
 */
95
 */
96
index_t hash(unative_t key[])
96
size_t hash(unative_t key[])
97
{
97
{
98
    as_t *as = (as_t *) key[KEY_AS];
98
    as_t *as = (as_t *) key[KEY_AS];
99
    uintptr_t page = (uintptr_t) key[KEY_PAGE];
99
    uintptr_t page = (uintptr_t) key[KEY_PAGE];
100
    index_t index;
100
    size_t index;
101
   
101
   
102
    /*
102
    /*
103
     * Virtual page addresses have roughly the same probability
103
     * Virtual page addresses have roughly the same probability
104
     * of occurring. Least significant bits of VPN compose the
104
     * of occurring. Least significant bits of VPN compose the
105
     * hash index.
105
     * hash index.
Line 122... Line 122...
122
 * @param keys Number of keys passed.
122
 * @param keys Number of keys passed.
123
 * @param item Item to compare the keys with.
123
 * @param item Item to compare the keys with.
124
 *
124
 *
125
 * @return true on match, false otherwise.
125
 * @return true on match, false otherwise.
126
 */
126
 */
127
bool compare(unative_t key[], count_t keys, link_t *item)
127
bool compare(unative_t key[], size_t keys, link_t *item)
128
{
128
{
129
    pte_t *t;
129
    pte_t *t;
130
 
130
 
131
    ASSERT(item);
131
    ASSERT(item);
132
    ASSERT((keys > 0) && (keys <= PAGE_HT_KEYS));
132
    ASSERT((keys > 0) && (keys <= PAGE_HT_KEYS));