Phoenix
Object-oriented orthogonally persistent operating system
Classes | Functions | Variables
vm_mm.cpp File Reference

Kernel virtual memory manager implementation. More...

#include <sys.h>
#include <boot.h>
#include <efi.h>
Include dependency graph for vm_mm.cpp:

Classes

struct  KmemDebugOverhead
 Overhead for dynamically allocated memory chunks for storing debug information. More...

Functions

static void MapHeap ()
 Map all pages starting from the last mapped heap address till the current heap pointer.
static void * KmemAllocate (size_t size, size_t align=0)
 Kernel dynamic memory allocation.
static void KmemFree (void *ptr)
 Kernel dynamic memory freeing.
void * __operator_new (size_t size, const char *file, int line, bool isArray, size_t align)
 Back-end for operator new which should be implemented by each environment.
void * __operator_new (size_t size, bool isArray, size_t align)
 Back-end for operator new which should be implemented by each environment.
void __operator_delete (void *ptr, bool isArray)
 Back-end for operator delete which should be implemented by each environment.

Variables

static vaddr_t tmpHeap
 Temporal location for heap pointer (during vm::MM::IS_INITIAL phase).
static vaddr_t tmpQuickMap
 Temporal location for quick map pages address (during vm::MM::IS_INITIAL phase).
static void ** tmpQuickMapPte
 Temporal location for quick map PTEs (during vm::MM::IS_INITIAL phase).
static paddr_t tmpDefaultLatRoot
 Temporal location for defaultLatEntryroot table (during vm::MM::IS_INITIAL phase).
static vaddr_t tmpLastMappedHeap
 Temporal location for last mapped heap address.

Detailed Description

Kernel virtual memory manager implementation.


Function Documentation

void __operator_delete ( void *  ptr,
bool  isArray = false 
)

Back-end for operator delete which should be implemented by each environment.

Parameters:
ptrPointer to the memory block being freed.
isArraytrue if delete[] operator was invoked, false otherwise.
void* __operator_new ( size_t  size,
bool  isArray = false,
size_t  align = 0 
)

Back-end for operator new which should be implemented by each environment.

This version is invoked in release builds.

Parameters:
sizeAllocation size.
isArraytrue if new[] operator was invoked, false otherwise.
alignAlignment value. Zero indicates that no specific alignment required.
Returns:
Pointer to allocated memory block.
void* __operator_new ( size_t  size,
const char *  file,
int  line,
bool  isArray = false,
size_t  align = 0 
)

Back-end for operator new which should be implemented by each environment.

This version is invoked in debug builds with source code location in arguments.

Parameters:
sizeAllocation size.
fileSource file name where from the operator is invoked.
lineLine number in the source file where from the operator is invoked.
isArraytrue if new[] operator was invoked, false otherwise.
alignAlignment value. Zero indicates that no specific alignment required.
Returns:
Pointer to allocated memory block.
static void* KmemAllocate ( size_t  size,
size_t  align = 0 
) [inline, static]

Kernel dynamic memory allocation.

This function can be used only by new operators. All the rest code must use new operators for all dynamic memory allocations.

Parameters:
sizeSize of memory chunk to allocate.
alignAlignment of memory chunk. Must be power of two. Zero for default alignment.
static void KmemFree ( void *  ptr) [inline, static]

Kernel dynamic memory freeing.

This function can be used only by delete operators. All the rest code must use delete operators for all dynamic memory freeings.

Parameters:
ptrPointer to dynamically allocated memory chunk. Nothing is done if it is zero.
static void MapHeap ( ) [static]

Map all pages starting from the last mapped heap address till the current heap pointer.

This function is used only during vm::MM::IS_INITIAL phase.


Variable Documentation

Temporal location for defaultLatEntryroot table (during vm::MM::IS_INITIAL phase).

vaddr_t tmpHeap [static]

Temporal location for heap pointer (during vm::MM::IS_INITIAL phase).

Temporal location for last mapped heap address.

Heap is mapped up to this address. The value is valid during vm::MM::IS_INITIAL phase.

vaddr_t tmpQuickMap [static]

Temporal location for quick map pages address (during vm::MM::IS_INITIAL phase).

void** tmpQuickMapPte [static]

Temporal location for quick map PTEs (during vm::MM::IS_INITIAL phase).

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines