Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Mapdb Class Reference

The mapping database. More...

#include <mapdb.h>

List of all members.

Public Member Functions

 Mapdb (Address start, Address end)
 Constructor.
 ~Mapdb ()
 Destructor.
Mappinglookup (unsigned space, Address va, Address phys)
 Lookup a mapping and lock the corresponding mapping tree.
void free (Mapping *mapping_of_tree)
 Unlock the mapping tree to which the mapping belongs.
void grant (Mapping *m, unsigned new_space, Address va)
 Change ownership of a mapping.

Static Public Member Functions

static Mappinginsert (Mapping *parent, unsigned space, Address va, size_t size, Mapping_type type)
 Insert a new mapping entry with the given values as child of "parent".
static void flush (Mapping *m, bool me_too)
 Delete mappings from a tree.
static bool valid_address (Address phys)

Private Attributes

Physframephysframe
Address _start

Friends

class Jdb_mapdb


Detailed Description

The mapping database.


Constructor & Destructor Documentation

Mapdb::Mapdb Address  start,
Address  end
 

Constructor.

Parameters:
start physical start address of RAM
end physical end address of RAM.

Mapdb::~Mapdb  ) 
 

Destructor.


Member Function Documentation

void Mapdb::flush Mapping m,
bool  me_too
[static]
 

Delete mappings from a tree.

This function deleted mappings recusively.

Parameters:
m Mapping that denotes the subtree that should be deleted.
me_too If true, delete m as well; otherwise, delete only submappings.

void Mapdb::free Mapping mapping_of_tree  ) 
 

Unlock the mapping tree to which the mapping belongs.

Once a tree has been unlocked, all Mapping instances pointing into it become invalid.

A mapping tree is locked during lookup(). When the tree is locked, the tree may be traversed (using member functions of Mapping, which serves as an iterator over the tree) or manipulated (using insert(), free(), flush(), grant()). Note that only one insert() is allowed during each locking cycle.

Parameters:
mapping_of_tree Any mapping belonging to a mapping tree.

void Mapdb::grant Mapping m,
unsigned  new_space,
Address  va
 

Change ownership of a mapping.

Parameters:
m Mapping to be modified.
new_space Number of address space the mapping should be transferred to
va Virtual address of the mapping in the new address space

Mapping * Mapdb::insert Mapping parent,
unsigned  space,
Address  va,
size_t  size,
Mapping_type  type
[static]
 

Insert a new mapping entry with the given values as child of "parent".

We assume that there is at least one free entry at the end of the array so that at least one insert() operation can succeed between a lookup()/free() pair of calls. This is guaranteed by the free() operation which allocates a larger tree if the current one becomes to small.

Parameters:
parent Parent mapping of the new mapping.
space Number of the address space into which the mapping is entered
va Virtual address of the mapped page.
size Size of the mapping. For memory mappings, 4K or 4M.
type Type of the mapping (Map_mem or Map_io).
Returns:
If successful, new mapping. If out of memory or mapping tree full, 0.
Postcondition:
All Mapping* pointers pointing into this mapping tree, except "parent" and its parents, will be invalidated.

Mapping * Mapdb::lookup unsigned  space,
Address  va,
Address  phys
 

Lookup a mapping and lock the corresponding mapping tree.

The returned mapping pointer, and all other mapping pointers derived from it, remain valid until free() is called on one of them. We guarantee that at most one insert() operation succeeds between one lookup()/free() pair of calls (it succeeds unless the mapping tree is full).

Parameters:
space Number of virtual address space in which the mapping was entered
va Virtual address of the mapping
phys Physical address of the mapped pag frame
type Type of the mapping (Map_mem or Map_io).
Returns:
mapping, if found; otherwise, 0

bool Mapdb::valid_address Address  phys  )  [inline, static]
 


Friends And Related Function Documentation

friend class Jdb_mapdb [friend]
 


Member Data Documentation

Address Mapdb::_start [private]
 

Physframe* Mapdb::physframe [private]
 


The documentation for this class was generated from the following files:
Generated on Mon Sep 26 14:20:16 2005 for Fiasco by  doxygen 1.4.2