- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# 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 <ubixos/vitals.h>`
`#include <ubixos/spinlock.h>`
`#include <assert.h>`

Include dependency graph for vmm_memory.c:

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
mMap * | vmmMemoryMap = (mMap *) 0x101000
static spinLock_t | vmmSpinLock = SPIN_LOCK_INITIALIZER

## Function Documentation

int adjustCowCounter | ( | uInt32 | baseAddr,
|  | int | adjustment |
| ) |  |  |

Definition at line 266 of file vmm_memory.c.

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

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

Here is the call graph for this function:

int countMemory | ( |  | ) |

Definition at line 104 of file vmm_memory.c.

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

Referenced by vmmMemMapInit().

Here is the call graph for this function:

int freePage | ( | uInt32 | pageAddr | ) |

Definition at line 228 of file vmm_memory.c.

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

Referenced by vmm_remapPage().

Here is the call graph for this function:

uInt32 vmmFindFreePage | ( | pidType | pid | ) |

Definition at line 186 of file vmm_memory.c.

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

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

Here is the call graph for this function:

void vmmFreeProcessPages | ( | pidType | pid | ) |

Definition at line 296 of file vmm_memory.c.

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

Referenced by systemTask().

Here is the call graph for this function:

int vmmMemMapInit | ( |  | ) |

Definition at line 57 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().

Here is the call graph for this function:

## Variable Documentation

uInt32 freePages = 0`[static]`

Definition at line 39 of file vmm_memory.c.

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

int numPages = 0x0

Definition at line 44 of file vmm_memory.c.

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

spinLock_t vmmCowSpinLock = SPIN_LOCK_INITIALIZER`[static]`

Definition at line 41 of file vmm_memory.c.

Referenced by adjustCowCounter().

mMap* vmmMemoryMap = (mMap *) 0x101000

Definition at line 45 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 40 of file vmm_memory.c.

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