Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Segment_map Class Reference

A segment map maps segment index numbers to their corresponding page counts (the number of pages a segment contains). More...

#include <segment.h>

Inherits Address_map.

Inheritance diagram for Segment_map:

Inheritance graph
[legend]
Collaboration diagram for Segment_map:

Collaboration graph
[legend]
List of all members.

Public Methods

void set_pages_count (unsigned int segment, unsigned int pages_count)
unsigned int get_pages_count (unsigned int segment)
void set_next_free_segment (unsigned int segment, unsigned int next_free_segment)
unsigned int get_next_free_segment (unsigned int segment)
bool is_segment_free (unsigned int segment)

Detailed Description

A segment map maps segment index numbers to their corresponding page counts (the number of pages a segment contains).

Incidentally, a segment map is also handy for keeping track of which segments are unused.

If a segment has pages stored in it, then the lowest bit of its page count is set to one. The rest of the bits constitute the actual page count (shifted left to make way for the flag in the lowest bit). If a segment is unused, then the lowest bit of its page count is set to zero. The rest of the bits are available for storing the index of the next unused segment.


Member Function Documentation

unsigned int Segment_map::get_next_free_segment unsigned int    segment
 

Return the index of the next free segment after the given free segment.

unsigned int Segment_map::get_pages_count unsigned int    segment
 

Return the number of pages contained within the given segment.

bool Segment_map::is_segment_free unsigned int    segment
 

Return whether the given segment is unused.

void Segment_map::set_next_free_segment unsigned int    segment,
unsigned int    next_free_segment
 

Assuming the given segment is a free segment, store the index of the next free segment.

void Segment_map::set_pages_count unsigned int    segment,
unsigned int    pages_count
 

Set the number of pages contained within the given segment.


The documentation for this class was generated from the following files:

Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman