genarch
[Memory management]


Files

file  as_ht.h
file  asid_fifo.h
file  page_ht.h
file  as_ht.c
 Address space functions for global page hash table.
file  asid.c
 ASID management.
file  asid_fifo.c
 FIFO queue ASID management.
file  page_ht.c
 Virtual Address Translation (VAT) for global page hash table.

Defines

#define FIFO_STATIC_LIMIT   1024
#define FIFO_STATIC   (ASIDS_ALLOCABLE<FIFO_STATIC_LIMIT)

Functions

void asid_fifo_init (void)
static pte_tht_create (int flags)
static void ht_destroy (pte_t *page_table)
static void ht_lock (as_t *as, bool lock)
static void ht_unlock (as_t *as, bool unlock)
 SPINLOCK_INITIALIZE (asidlock)
asid_t asid_get (void)
void asid_put (asid_t asid)
 FIFO_INITIALIZE_STATIC (free_asids, asid_t, ASIDS_ALLOCABLE)
asid_t asid_find_free (void)
void asid_put_arch (asid_t asid)
static index_t hash (__native key[])
static bool compare (__native key[], count_t keys, link_t *item)
static void remove_callback (link_t *item)
static void ht_mapping_insert (as_t *as, __address page, __address frame, int flags)
static void ht_mapping_remove (as_t *as, __address page)
static pte_tht_mapping_find (as_t *as, __address page)

Variables

as_operations_t as_ht_operations
as_operations_t as_ht_operations
static count_t asids_allocated = 0
mutex_t page_ht_lock
hash_table_t page_ht
hash_table_operations_t ht_operations
page_mapping_operations_t ht_mapping_operations

Define Documentation

#define FIFO_STATIC   (ASIDS_ALLOCABLE<FIFO_STATIC_LIMIT)
 

Definition at line 49 of file asid_fifo.c.

#define FIFO_STATIC_LIMIT   1024
 

Definition at line 48 of file asid_fifo.c.


Function Documentation

void asid_fifo_init void   ) 
 

Initialize data structures for O(1) ASID allocation and deallocation.

Definition at line 62 of file asid_fifo.c.

References ASID_START, ASIDS_ALLOCABLE, fifo_create, and fifo_push.

Referenced by as_arch_init().

asid_t asid_find_free void   ) 
 

Allocate free ASID.

Allocation runs in O(1).

Returns:
Free ASID.

Definition at line 81 of file asid_fifo.c.

References fifo_pop.

Referenced by asid_get().

asid_t asid_get void   ) 
 

Allocate free address space identifier.

Interrupts must be disabled and inactive_as_with_asid_lock must be held prior to this call

Returns:
New ASID.

Definition at line 83 of file asid.c.

References asid_find_free(), ASID_INVALID, asidlock, ASIDS_ALLOCABLE, asids_allocated, ASSERT, list_empty(), list_get_instance, list_remove(), mutex_lock_active, mutex_unlock(), link::next, spinlock_lock, spinlock_unlock(), tlb_invalidate_asid(), TLB_INVL_ASID, tlb_shootdown_finalize(), and tlb_shootdown_start().

Referenced by as_switch().

Here is the call graph for this function:

void asid_put asid_t  asid  ) 
 

Release address space identifier.

This code relies on architecture dependent functionality.

Parameters:
asid ASID to be released.

Definition at line 163 of file asid.c.

References asid_put_arch(), asidlock, asids_allocated, interrupts_disable(), interrupts_restore(), spinlock_lock, and spinlock_unlock().

Referenced by as_destroy().

Here is the call graph for this function:

void asid_put_arch asid_t  asid  ) 
 

Return ASID among free ASIDs.

This operation runs in O(1).

Parameters:
asid ASID being freed.

Definition at line 92 of file asid_fifo.c.

References fifo_push.

Referenced by asid_put().

bool compare __native  key[],
count_t  keys,
link_t item
[static]
 

Compare page hash table item with page and/or address space.

Parameters:
key Array of one or two keys (i.e. page and/or address space).
keys Number of keys passed.
item Item to compare the keys with.
Returns:
true on match, false otherwise.

Definition at line 127 of file page_ht.c.

References ASSERT, and hash_table_get_instance.

Referenced by tick_init().

FIFO_INITIALIZE_STATIC free_asids  ,
asid_t  ,
ASIDS_ALLOCABLE 
 

FIFO queue containing unassigned ASIDs. Can be only accessed when asidlock is held.

index_t hash __native  key[]  )  [static]
 

Compute page hash table index.

Parameters:
key Array of two keys (i.e. page and address space).
Returns:
Index into page hash table.

Definition at line 96 of file page_ht.c.

References PAGE_WIDTH.

pte_t * ht_create int  flags  )  [static]
 

Page hash table create.

The page hash table will be created only once and will be shared by all address spaces.

Parameters:
flags Ignored.
Returns:
Returns NULL.

Definition at line 71 of file as_ht.c.

References hash_table_create(), ht_operations, mutex_initialize(), NULL, page_ht, and page_ht_lock.

Here is the call graph for this function:

void ht_destroy pte_t page_table  )  [static]
 

Destroy page table.

Actually do nothing as the global page hash table is used.

Parameters:
page_table This parameter is ignored.

Definition at line 86 of file as_ht.c.

void ht_lock as_t as,
bool  lock
[static]
 

Lock page table.

Lock address space and page hash table. Interrupts must be disabled.

Parameters:
as Address space.
lock If false, do not attempt to lock the address space.

Definition at line 99 of file as_ht.c.

References mutex_lock, and page_ht_lock.

pte_t * ht_mapping_find as_t as,
__address  page
[static]
 

Find mapping for virtual page in page hash table.

Find mapping for virtual page.

The page table must be locked and interrupts must be disabled.

Parameters:
as Address space to wich page belongs.
page Virtual page.
Returns:
NULL if there is no such mapping; requested mapping otherwise.

Definition at line 234 of file page_ht.c.

References ALIGN_DOWN, hash_table_find(), hash_table_get_instance, NULL, page_ht, and PAGE_SIZE.

Here is the call graph for this function:

void ht_mapping_insert as_t as,
__address  page,
__address  frame,
int  flags
[static]
 

Map page to frame using page hash table.

Map virtual address page to physical address frame using flags.

The page table must be locked and interrupts must be disabled.

Parameters:
as Address space to which page belongs.
page Virtual address of the page to be mapped.
frame Physical address of memory frame to which the mapping is done.
flags Flags to be used for mapping.

Definition at line 176 of file page_ht.c.

References ALIGN_DOWN, ASSERT, FRAME_ATOMIC, FRAME_SIZE, hash_table_find(), hash_table_insert(), malloc(), NULL, PAGE_CACHEABLE, PAGE_EXEC, PAGE_GLOBAL, page_ht, PAGE_NOT_PRESENT, PAGE_SIZE, PAGE_USER, and PAGE_WRITE.

Here is the call graph for this function:

void ht_mapping_remove as_t as,
__address  page
[static]
 

Remove mapping of page from page hash table.

Remove any mapping of page within address space as. TLB shootdown should follow in order to make effects of this call visible.

The page table must be locked and interrupts must be disabled.

Parameters:
as Address space to wich page belongs.
page Virtual address of the page to be demapped.

Definition at line 211 of file page_ht.c.

References ALIGN_DOWN, hash_table_remove(), page_ht, and PAGE_SIZE.

Here is the call graph for this function:

void ht_unlock as_t as,
bool  unlock
[static]
 

Unlock page table.

Unlock address space and page hash table. Interrupts must be disabled.

Parameters:
as Address space.
unlock If false, do not attempt to lock the address space.

Definition at line 114 of file as_ht.c.

References mutex_unlock(), and page_ht_lock.

Here is the call graph for this function:

void remove_callback link_t item  )  [static]
 

Callback on page hash table item removal.

Parameters:
item Page hash table item being removed.

Definition at line 150 of file page_ht.c.

References ASSERT, free(), and hash_table_get_instance.

Here is the call graph for this function:

SPINLOCK_INITIALIZE asidlock   ) 
 

asidlock protects the asids_allocated counter.


Variable Documentation

as_operations_t as_ht_operations
 

Initial value:

 {
        .page_table_create = ht_create,
        .page_table_destroy = ht_destroy,
        .page_table_lock = ht_lock,
        .page_table_unlock = ht_unlock,
}

Definition at line 54 of file as_ht.c.

Referenced by as_arch_init().

as_operations_t as_ht_operations
 

Definition at line 54 of file as_ht.c.

Referenced by as_arch_init().

count_t asids_allocated = 0 [static]
 

Definition at line 74 of file asid.c.

Referenced by asid_get(), and asid_put().

page_mapping_operations_t ht_mapping_operations
 

Initial value:

 {
        .mapping_insert = ht_mapping_insert,
        .mapping_remove = ht_mapping_remove,
        .mapping_find = ht_mapping_find
}
Page mapping operations for page hash table architectures.

Definition at line 84 of file page_ht.c.

Referenced by page_arch_init().

hash_table_operations_t ht_operations
 

Initial value:

 {
        .hash = hash,
        .compare = compare,
        .remove_callback = remove_callback
}
Hash table operations for page hash table.

Definition at line 77 of file page_ht.c.

Referenced by ht_create().

hash_table_t page_ht
 

Page hash table. The page hash table may be accessed only when page_ht_lock is held.

Definition at line 74 of file page_ht.c.

Referenced by ht_create(), ht_mapping_find(), ht_mapping_insert(), and ht_mapping_remove().

mutex_t page_ht_lock
 

This lock protects the page hash table. It must be acquired after address space lock and after any address space area locks.

Definition at line 68 of file page_ht.c.

Referenced by ht_create(), ht_lock(), and ht_unlock().


Generated on Sun Jun 18 17:45:00 2006 for HelenOS Kernel (sparc64) by  doxygen 1.4.6