Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields  

Toy Memory Page Manager


Modules

Toy Segment Manager
Toy Memory Swap Manager

Functions

int TMM_PagingEnabled (ToyMM *tmm)
 Checks if paging is enabled. Returns 0 on yes, -1 on no.

int TMM_GetRealAddress (ToyMM *tmm, int process, int vaddr)
 Turns a virtual address into a real address.

int TMM_GetNumPages (ToyMM *tmm)
 Returns the number of pages in paging mode, or -1 in legacy mode.

int TMM_GetFramedSize (ToyMM *tmm, int size)
 Pads a segment size to the size of the minimum # of frames.

int TMM_VirtualToReal (ToyMM *tmm, Process *proc, int vaddr)
 Converts a virtual address to a real address.

int TMM_GetNumFrames (ToyMM *tmm, int length)
 Counts the minimum # of frames needed for a size of mem.

void TMM_AssignFrame (ToyMM *tmm, int process, int frame, int page)
 Assigns passed frame to passed page in passsed process.

void TMM_EmptyFrame (ToyMM *tmm, int frame)
 Marks every memory element in a frame as empty.

void TMM_FreeFrame (ToyMM *tmm, int process, int page)
 Removes passed frame from passed process, marking it as free.

int TMM_FindFreeFrame (ToyMM *tmm)
 Finds the first available frame, if any.

int TMM_FrameFree (ToyMM *tmm, int frame)
 Returns 0 if the frame is unused, -1 otherwise.

InvPageTableTMM_GetFrame (ToyMM *tmm, int frame)
 Returns specified element of frame table, or NULL if nonexistent.

PageTableTMM_GetPage (ToyMM *tmm, int process, int page)
 Returns specified element of page table, or NULL if nonexistent.

int TMM_PageFree (ToyMM *tmm, int process, int page)
 Returns 0 if specified page of process is unused, -1 otherwise.

int TMM_CountFreePages (ToyMM *tmm, int process)
 Returns the # of free pages in specified process.

void TMM_IncrementLinearScan (ToyMM *tmm)
 Increments the linear scanning pointer.

int TMM_PageSwappedOut (ToyMM *tmm, int process, int page)
 Returns 0 if page is swapped out, -1 if not.

int TMM_PageSwappedIn (ToyMM *tmm, int process, int page)
 Returns 0 if page is swapped in, -1 if not.

void TMM_MarkPageSwappedOut (ToyMM *tmm, int process, int page)
 Marks a page as swapped out.

void TMM_ClearFrameStatus (ToyMM *tmm, int frame)
 Marks a frame as not recently used.

void TMM_SetFrameStatus (ToyMM *tmm, int frame)
 Marks a frame as recently used.


Function Documentation

void TMM_AssignFrame ToyMM   tmm,
int    process,
int    frame,
int    page
 

Assigns passed frame to passed page in passsed process.

Definition at line 275 of file ToyVirtualMem.c.

References PageTable::frame, InvPageTable::ID, ToyMM::invPageTable, InvPageTable::page, PageTable::paged, Process::pagetable, InvPageTable::status, and TMM_EmptyFrame().

Referenced by TMM_SwapIn().

void TMM_ClearFrameStatus ToyMM   tmm,
int    frame
 

Marks a frame as not recently used.

Definition at line 34 of file ToyVirtualMem.c.

References InvPageTable::status, and TMM_GetFrame().

Referenced by TMM_FindFreeFrame().

int TMM_CountFreePages ToyMM   tmm,
int    process
 

Returns the # of free pages in specified process.

Definition at line 90 of file ToyVirtualMem.c.

References TMM_GetNumPages(), TMM_PageFree(), and TMM_PagingEnabled().

void TMM_EmptyFrame ToyMM   tmm,
int    frame
 

Marks every memory element in a frame as empty.

Definition at line 262 of file ToyVirtualMem.c.

References ToyMM::mem, ToyMM::pageSize, and ToyMem::type.

Referenced by TMM_AssignFrame(), and TMM_FreeFrame().

int TMM_FindFreeFrame ToyMM   tmm
 

Finds the first available frame, if any.

Definition at line 159 of file ToyVirtualMem.c.

References ToyMM::invPageTable, ToyMM::page, TMM_ClearFrameStatus(), TMM_FrameFree(), TMM_GetNumPages(), TMM_IncrementLinearScan(), and TMM_SwapOut().

Referenced by TMM_GetRealAddress().

int TMM_FrameFree ToyMM   tmm,
int    frame
 

Returns 0 if the frame is unused, -1 otherwise.

Definition at line 115 of file ToyVirtualMem.c.

References InvPageTable::ID, ToyMM::invPageTable, TMM_GetNumPages(), and TMM_PagingEnabled().

Referenced by TMM_FindFreeFrame(), and TMM_SwapIn().

void TMM_FreeFrame ToyMM   tmm,
int    process,
int    page
 

Removes passed frame from passed process, marking it as free.

Definition at line 293 of file ToyVirtualMem.c.

References PageTable::frame, ToyMM::invPageTable, PageTable::paged, Process::pagetable, and TMM_EmptyFrame().

Referenced by TMM_PagedTerminateProcess(), TMM_SwapIn(), and TMM_SwapOut().

InvPageTable* TMM_GetFrame ToyMM   tmm,
int    frame
 

Returns specified element of frame table, or NULL if nonexistent.

Definition at line 106 of file ToyVirtualMem.c.

References ToyMM::invPageTable, TMM_GetNumPages(), and TMM_PagingEnabled().

Referenced by TMM_ClearFrameStatus(), and TMM_SetFrameStatus().

int TMM_GetFramedSize ToyMM   tmm,
int    size
 

Pads a segment size to the size of the minimum # of frames.

Definition at line 213 of file ToyVirtualMem.c.

References ToyMM::pageSize, and TMM_GetNumFrames().

int TMM_GetNumFrames ToyMM   tmm,
int    length
 

Counts the minimum # of frames needed for a size of mem.

Definition at line 202 of file ToyVirtualMem.c.

References ToyMM::pageSize, and TMM_PagingEnabled().

Referenced by TMM_GetFramedSize().

int TMM_GetNumPages ToyMM   tmm
 

Returns the number of pages in paging mode, or -1 in legacy mode.

Definition at line 145 of file ToyVirtualMem.c.

References ToyMM::memSize, ToyMM::pageSize, and TMM_PagingEnabled().

Referenced by TMM_CountFreePages(), TMM_EnablePaging(), TMM_FindFreeFrame(), TMM_FrameFree(), TMM_GetFrame(), TMM_GetPage(), TMM_IncrementLinearScan(), TMM_PagedAllocateProcess(), TMM_PagedTerminateProcess(), TMM_PrintFrames(), TMM_PrintInvertedPageTable(), TMM_PrintPages(), and TMM_PrintPageTable().

PageTable* TMM_GetPage ToyMM   tmm,
int    process,
int    page
 

Returns specified element of page table, or NULL if nonexistent.

Definition at line 125 of file ToyVirtualMem.c.

References Process::pagetable, TMM_GetNumPages(), and TMM_PagingEnabled().

Referenced by TMM_PageFree(), TMM_PageSwappedIn(), and TMM_PageSwappedOut().

int TMM_GetRealAddress ToyMM   tmm,
int    process,
int    vaddr
 

Turns a virtual address into a real address.

Definition at line 232 of file ToyVirtualMem.c.

References ToyMM::pageSize, TMM_FindFreeFrame(), TMM_PageSwappedOut(), TMM_PagingEnabled(), TMM_SetFrameStatus(), and TMM_SwapIn().

Referenced by TMM_AllocateHeap(), TMM_StoreHeapInteger(), TMM_StoreHeapString(), TMM_StoreInteger(), and TMM_StoreString().

void TMM_IncrementLinearScan ToyMM   tmm
 

Increments the linear scanning pointer.

Definition at line 51 of file ToyVirtualMem.c.

References ToyMM::page, TMM_GetNumPages(), and TMM_PagingEnabled().

Referenced by TMM_FindFreeFrame().

void TMM_MarkPageSwappedOut ToyMM   tmm,
int    process,
int    page
 

Marks a page as swapped out.

Definition at line 66 of file ToyVirtualMem.c.

References PageTable::frame, PageTable::paged, Process::pagetable, and ToyMM::processList.

Referenced by TMM_SwapOut().

int TMM_PageFree ToyMM   tmm,
int    process,
int    page
 

Returns 0 if specified page of process is unused, -1 otherwise.

Definition at line 136 of file ToyVirtualMem.c.

References PageTable::frame, PageTable::paged, and TMM_GetPage().

Referenced by TMM_CountFreePages(), TMM_PrintPages(), and TMM_SwapOut().

int TMM_PageSwappedIn ToyMM   tmm,
int    process,
int    page
 

Returns 0 if page is swapped in, -1 if not.

Definition at line 72 of file ToyVirtualMem.c.

References PageTable::frame, PageTable::paged, and TMM_GetPage().

Referenced by TMM_SwapIn().

int TMM_PageSwappedOut ToyMM   tmm,
int    process,
int    page
 

Returns 0 if page is swapped out, -1 if not.

Definition at line 81 of file ToyVirtualMem.c.

References PageTable::frame, PageTable::paged, and TMM_GetPage().

Referenced by TMM_GetRealAddress(), TMM_PrintPages(), TMM_SwapIn(), and TMM_SwapOut().

int TMM_PagingEnabled ToyMM   tmm
 

Checks if paging is enabled. Returns 0 on yes, -1 on no.

Definition at line 22 of file ToyVirtualMem.c.

References ToyMM::invPageTable, and ToyMM::pageSize.

Referenced by TMM_CountFreePages(), TMM_FrameFree(), TMM_Free(), TMM_GetFrame(), TMM_GetNumFrames(), TMM_GetNumPages(), TMM_GetPage(), TMM_GetRealAddress(), TMM_IncrementLinearScan(), TMM_PrintFrames(), TMM_PrintPages(), TMM_SwapCreate(), and TMM_TerminateProcess().

void TMM_SetFrameStatus ToyMM   tmm,
int    frame
 

Marks a frame as recently used.

Definition at line 42 of file ToyVirtualMem.c.

References InvPageTable::status, and TMM_GetFrame().

Referenced by TMM_GetRealAddress().

int TMM_VirtualToReal ToyMM   tmm,
Process   proc,
int    vaddr
 

Converts a virtual address to a real address.


Generated on Fri Apr 4 14:29:08 2003 for ToyMem by doxygen1.3-rc3