Main Page | Data Structures | File List | Globals | Related Pages

frame.h File Reference

Interface for the frame allocator. More...

#include <page.h>
#include <list.h>

Go to the source code of this file.

Data Structures

struct  Frame
struct  FrameAllocator

Defines

#define FRAME_SIZE   PAGE_SIZE
#define FRAME_ADDRESS_BITS   (32 - PAGE_SHIFT)
#define FRAME_ALIGNMENT_BITS   (PAGE_SHIFT - 1)
#define FRAME_ALIGNMENT_MAXIMUM   (FRAME_ADDRESS_BITS - 1)
#define FRAME_ADDRESS(frame)   ((frame) -> address * FRAME_SIZE)

Typedefs

typedef unsigned int FrameAddress
typedef unsigned int FrameAlignment

Functions

int frame_allocator_initialize (FrameAddress start, FrameAddress end)
 Initializes the frame allocator.

void frame_allocator_reserve (FrameAddress start, FrameAddress end)
 Reserve frame from the allocator.

Frame * frame_allocate_within (FrameAlignment alignment, FrameAddress start, FrameAddress end)
 Allocate a frame within a memory region.

Frame * frame_allocate (FrameAlignment alignment)
 Allocate a frame.

void frame_free (Frame *frame)
 Free a frame.

unsigned int frame_availability (void)
 The number of available frames for allocation.


Detailed Description

Interface for the frame allocator.

Interface for physical page frame allocation.

Bug:
No known bugs.
Author:
Lee Salzman (lsalzman)

Function Documentation

Frame* frame_allocate FrameAlignment  alignment  ) 
 

Allocate a frame.

Allocate a frame from anywhere within the managed physical memory.

Parameters:
alignment the alignment of the frame
Returns:
The allocated frame or NULL on failure.

Frame* frame_allocate_within FrameAlignment  alignment,
FrameAddress  start,
FrameAddress  end
 

Allocate a frame within a memory region.

Allocates a frame of the specified alignment within a given region of the physical address space.

Parameters:
alignment the alignment of the frame
start the frame address of the start of the region
end the frame address of the last acceptable firame of the region
Returns:
The allocated frame or NULL on failure.

int frame_allocator_initialize FrameAddress  start,
FrameAddress  end
 

Initializes the frame allocator.

Initialize the frame allocator to manage a specified region of physical memory.

Parameters:
start the frame address of the start of the managed region
end the frame address of the last frame of the managed region
Returns:
0 on success -1 on failure

void frame_allocator_reserve FrameAddress  start,
FrameAddress  end
 

Reserve frame from the allocator.

Reserves page frames from the allocator so that they may not be used.

Parameters:
start the frame address of the start of the reserved frames
end the frame address of the last frame of the reserved frames
Returns:
Void

unsigned int frame_availability void   ) 
 

The number of available frames for allocation.

Return the number of frames available for allocation, if allocated at the least alignment possible.

Returns:
The number of frames.

void frame_free Frame *  frame  ) 
 

Free a frame.

Return the frame to the free list

Parameters:
frame the frame to free
Returns:
Void


Generated on Fri Apr 9 21:59:16 2004 for 15-410 Project 3 by doxygen 1.3.2