vmm_memory.c File Reference

#include <vmm/vmm.h>
#include <sys/io.h>
#include <ubixos/kpanic.h>
#include <lib/kprintf.h>
#include <lib/kmalloc.h>
#include <sys/kern_sysctl.h>
#include <ubixos/spinlock.h>
#include <assert.h>

Go to the source code of this file.

Functions

int adjustCowCounter (uInt32 baseAddr, int adjustment)
int countMemory ()
int freePage (uInt32 pageAddr)
uInt32 vmmFindFreePage (pidType pid)
void vmmFreeProcessPages (pidType pid)
int vmmMemMapInit ()

Variables

static uInt32 freePages = 0
int numPages = 0x0
static spinLock_t vmmCowSpinLock = SPIN_LOCK_INITIALIZER
mMapvmmMemoryMap = (mMap *) 0x101000
static spinLock_t vmmSpinLock = SPIN_LOCK_INITIALIZER


Function Documentation

int adjustCowCounter ( uInt32  baseAddr,
int  adjustment 
)

Function: int adjustCowCounter(uInt32 baseAddr,int adjustment);

Description: This Adjust The COW Counter For Page At baseAddr It Will Error If The Count Goes Below 0

Notes:

08/01/02 - I Think If Counter Gets To 0 I Should Free The Page

Definition at line 270 of file vmm_memory.c.

References assert, mMap::cowCounter, freePages, memAvail, mMap::pid, spinLock(), spinUnlock(), mMap::status, systemVitals, vmmCowSpinLock, vmmID, and vmmMemoryMap.

Referenced by freePage(), vmm_pageFault(), vmmCopyVirtualSpace(), and vmmFreeProcessPages().

int countMemory (  ) 

Function: int countMemory(); Description: This Function Counts The Systems Physical Memory Notes:

02/20/2004 - Inspect For Quality And Approved

Definition at line 107 of file vmm_memory.c.

References cr0, inportByte(), and outportByte().

Referenced by vmmMemMapInit().

int freePage ( uInt32  pageAddr  ) 

Function: int freePage(uInt32 pageAddr);

Description: This Function Marks The Page As Free

Notes:

Definition at line 232 of file vmm_memory.c.

References adjustCowCounter(), assert, mMap::cowCounter, freePages, memAvail, mMap::pid, spinLock(), spinUnlock(), mMap::status, systemVitals, vmmMemoryMap, and vmmSpinLock.

Referenced by vmm_remapPage().

uInt32 vmmFindFreePage ( pidType  pid  ) 

Function: uInt32 vmmFindFreePage(pid_t pid);

Description: This Returns A Free Physical Page Address Then Marks It Not Available As Well As Setting The PID To The Proccess Allocating This Page Notes:

Definition at line 189 of file vmm_memory.c.

References freePages, kpanic(), memAvail, memNotavail, numPages, mMap::pid, spinLock(), spinUnlock(), status, sysctl_enabled, sysID, systemVitals, TRUE, vmmMemoryMap, and vmmSpinLock.

Referenced by execFile(), kmod_load(), ldEnable(), obreak(), sysExec(), vmm_getFreeMallocPage(), vmm_pageFault(), vmm_pagingInit(), vmm_remapPage(), vmmGetFreeKernelPage(), vmmGetFreePage(), and vmmGetFreeVirtualPage().

void vmmFreeProcessPages ( pidType  pid  ) 

Function: void vmmFreeProcessPages(pid_t pid);

Description: This Function Will Free Up Memory For The Exiting Process

Notes:

08/04/02 - Added Checking For COW Pages First

Definition at line 300 of file vmm_memory.c.

References adjustCowCounter(), mMap::cowCounter, freePages, memAvail, numPages, PAGE_COW, pageEntries, parentPageDirAddr, mMap::pid, spinLock(), spinUnlock(), status, systemVitals, tablesBaseAddress, vmmID, vmmMemoryMap, vmmSpinLock, and x1000.

Referenced by systemTask().

int vmmMemMapInit (  ) 

Function: void vmmMemMapInit(); Description: This Function Initializes The Memory Map For the System Notes:

02/20/2004 - Made It Report Real And Available Memory

Definition at line 60 of file vmm_memory.c.

References countMemory(), freePages, kprintf(), memAvail, memNotavail, numPages, mMap::pageAddr, mMap::pid, status, mMap::status, vmmID, vmmMemoryMap, and x1000.

Referenced by vmm_init().


Variable Documentation

uInt32 freePages = 0 [static]

Internal variables

Definition at line 42 of file vmm_memory.c.

Referenced by adjustCowCounter(), freePage(), vmmFindFreePage(), vmmFreeProcessPages(), and vmmMemMapInit().

int numPages = 0x0

Definition at line 47 of file vmm_memory.c.

Referenced by vmm_pagingInit(), vmmFindFreePage(), vmmFreeProcessPages(), and vmmMemMapInit().

spinLock_t vmmCowSpinLock = SPIN_LOCK_INITIALIZER [static]

Definition at line 44 of file vmm_memory.c.

Referenced by adjustCowCounter().

mMap* vmmMemoryMap = (mMap *) 0x101000

Definition at line 48 of file vmm_memory.c.

Referenced by adjustCowCounter(), freePage(), kmain(), vmm_pagingInit(), vmmFindFreePage(), vmmFreeProcessPages(), and vmmMemMapInit().

spinLock_t vmmSpinLock = SPIN_LOCK_INITIALIZER [static]

Definition at line 43 of file vmm_memory.c.

Referenced by freePage(), vmmFindFreePage(), and vmmFreeProcessPages().


Generated on Sun Dec 3 02:38:11 2006 for UbixOS V2 by  doxygen 1.4.7