#include <segment.h>
Inherits Address_map.
Inheritance diagram for Segment_map:
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) |
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.
|
Return the index of the next free segment after the given free segment.
|
|
Return the number of pages contained within the given segment.
|
|
Return whether the given segment is unused.
|
|
Assuming the given segment is a free segment, store the index of the next free segment.
|
|
Set the number of pages contained within the given segment.
|
Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman