#include "flGlobal.h"
#include "flMemoryVMem.h"
Go to the source code of this file.
Classes | |
struct | MemoryTree |
Defines | |
#define | MEMORY_UNCACHED_OFFSET 0x40000000 |
The offset that is added in order to make a pointer uncached. | |
#define | MEMORY_USER_BASE 0x08800000 |
The start of the user memory. | |
#define | MEMORY_USER_SIZE 0x01800000 |
The length of the user memory. | |
#define | MEMORY_KERNEL_BASE 0x08000000 |
The start of the kernel memory. | |
#define | MEMORY_KERNEL_SIZE 0x00800000 |
The length of the kernel memory. | |
#define | MEMORY_SCRATCHPAD_BASE 0x00010000 |
The start of the scratchpad memory. | |
#define | MEMORY_SCRATCHPAD_SIZE 0x00004000 |
The length of the scratchpad memory. | |
#define | MEMORY_PARTITION_KERNEL1_BASE 0x88000000 |
The start of kernel partition 1. | |
#define | MEMORY_PARTITION_KERNEL1_SIZE 0x00300000 |
The size of kernel partition 1. | |
#define | MEMORY_PARTITION_KERNEL2_BASE 0x88300000 |
The start of kernel partition 2. | |
#define | MEMORY_PARTITION_KERNEL2_SIZE 0x00100000 |
The size of kernel partition 2. | |
#define | MEMORY_PARTITION_KERNEL3_BASE 0x88400000 |
The start of kernel partition 3. | |
#define | MEMORY_PARTITION_KERNEL3_SIZE 0x00400000 |
The size of kernel partition 3. | |
#define | memSetByte(inPtr, inVal, inSize) memSetByteFrom(inPtr, inVal, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memSetShort(inPtr, inVal, inSize) memSetShortFrom(inPtr, inVal, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memClear(inPtr, inSize) memClearFrom(inPtr, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memCopy(inDest, inSrc, inSize) memCopyFrom(inDest, inSrc, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memCompare(inSrc0, inSrc1, inSize) memCompareFrom(inSrc0, inSrc1, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memAlloc(inSize) memAllocFrom(inSize, __FILE__, __FUNCTION__, __LINE__) |
This is a wrapper for malloc, it allows for extra options such as higher default alignment, memory integrity checks and overflowing into areas other than the heap. | |
#define | memCalloc(inSize0, inSize1) memCallocFrom(inSize0, inSize1, __FILE__, __FUNCTION__, __LINE__) |
#define | memQalloc(inSize) memQallocFrom(inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memAllocUncached(inSize) memAllocUncachedFrom(inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memRealloc(inData, inSize) memReallocFrom(inData, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memAlign(inBoundry, inSize) memAlignFrom(inBoundry, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define | memFree(inData) memFreeFrom(inData, __FILE__, __FUNCTION__, __LINE__) |
#define | memUncachedPtr(inPtr) memUncachedPtrFrom(inPtr, __FILE__, __FUNCTION__, __LINE__) |
#define | memErrorBytesCheck(inPtr) memErrorBytesCheckFrom(inPtr, __FILE__, __FUNCTION__, __LINE__) |
#define | memtAdd(inMemTree, inPtr, inSize, inAlignment) memtAddFrom(inMemTree, inPtr, inSize, inAlignment, __FILE__, __FUNCTION__, __LINE__) |
#define | memtDel(inMemTree, inPtr) memtDelFrom(inMemTree, inPtr, __FILE__, __FUNCTION__, __LINE__) |
#define | memtErrorBytesCheck(inMemTree) memtErrorBytesCheckFrom(inMemTree, __FILE__, __FUNCTION__, __LINE__) |
#define | memCachedPtr(inPtr) ((void*)((unsigned int)(inPtr) & ~MEMORY_UNCACHED_OFFSET)) |
#define | memIsUncachedPtr(inPtr) (((unsigned int)(inPtr) & MEMORY_UNCACHED_OFFSET) != 0) |
#define | memIsCachedPtr(inPtr) (((unsigned int)(inPtr) & MEMORY_UNCACHED_OFFSET) == 0) |
#define | memCachedPointer(inPtr) memCachedPtr(inPtr); |
#define | memUncachedPointer(inPtr) memUncachedPtr(inPtr); |
#define | memIsUncachedPointer(inPtr) memIsUncachedPtr(inPtr) |
#define | memIsCachedPointer(inPtr) memIsCachedPtr(inPtr) |
Functions | |
void | memInit () |
Called by flInitialize() to initialize the memory system. | |
void | memTerm () |
Called by flTerminate() to deinitialize the memory system. | |
u32 | memFreeSpace (u32 inAccuracy) |
Returns a close estimate of the amount of free space. | |
u32 | memFreeSpaceTotal () |
Returns a close estimate of the total amount of free space available to the program on the whole system, this includes video memory, scratchpad and any other memory funcLib can get it's hands on. | |
char * | memString (u32 inBytes, bool inBinary) |
Converts an amount of bytes into a more humanly readable string to be printed in a log or to the screen. | |
void | memSetByteFrom (void *inPtr, int inVal, unsigned int inSize, const char *inFile, const char *inFunc, int inLine) |
void | memSetShortFrom (void *inPtr, int inVal, unsigned int inSize, const char *inFile, const char *inFunc, int inLine) |
void | memClearFrom (void *inPtr, unsigned int inSize, const char *inFile, const char *inFunc, int inLine) |
void | memCopyFrom (void *inDest, void *inSrc, unsigned int inSize, const char *inFile, const char *inFunc, int inLine) |
int | memCompareFrom (void *inSrc0, void *inSrc1, unsigned int inSize, const char *inFile, const char *inFunc, int inLine) |
void * | memAllocFrom (int inSize, const char *inFile, const char *inFunc, int inLine) |
This functions is identical to memAlloc() except that it takes extra parameters to define where it was called from,. | |
void * | memCallocFrom (int inSize0, int inSize1, const char *inFile, const char *inFunc, int inLine) |
void * | memQallocFrom (int inSize, const char *inFile, const char *inFunc, int inLine) |
void * | memAllocUncachedFrom (int inSize, const char *inFile, const char *inFunc, int inLine) |
void * | memReallocFrom (void *inData, int inSize, const char *inFile, const char *inFunc, int inLine) |
void * | memAlignFrom (int inBoundry, int inSize, const char *inFile, const char *inFunc, int inLine) |
void | memFreeFrom (void *inData, const char *inFile, const char *inFunc, int inLine) |
void * | memUncachedPtrFrom (void *inPtr, const char *inFile, const char *inFunc, int inLine) |
u32 | memAddressAlignment (void *inPtr) |
Calculates the largest binary increment that a pointer is aligned to (e.g 16, 32, 64, 128, etc. | |
bool | memAddressValid (void *inPtr) |
Checks if a pointer resides within valid memory blocks on the terget platform. | |
bool | memBlockValid (void *inPtr, u32 inSize) |
Checks if a memory block resides within valid memory blocks on the terget platform. | |
bool | memErrorBytesCheckFrom (void *inPtr, const char *inFile, const char *inFunc, int inLine) |
void | memtAddFrom (MemoryTree **inMemTree, void *inPtr, u32 inSize, u32 inAlignment, const char *inFile, const char *inFunc, int inLine) |
void | memtDelFrom (MemoryTree **inMemTree, void *inPtr, const char *inFile, const char *inFunc, int inLine) |
void | memtErrorBytesCheckFrom (MemoryTree **inMemTree, const char *inFile, const char *inFunc, int inLine) |
Variables | |
MemoryTree * | memErrorTree |
bool | memInitialized |
A boolean to represent whether the memory system has been initialized or not, this is set by memInit() and memTerm(). | |
bool | memScratchpadUsed |
A boolean to represent whether the scratchpad is currently in use or not, this allows the fastest possible allocation/free'ing of memory for temp data. |
#define memAlign | ( | inBoundry, | |||
inSize | ) | memAlignFrom(inBoundry, inSize, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 160 of file flMemory.h.
Referenced by fontCreateDebugTex(), graphicsInit(), memAlignFrom(), memAllocUncachedFrom(), palCreate(), and texCreate().
#define memAlloc | ( | inSize | ) | memAllocFrom(inSize, __FILE__, __FUNCTION__, __LINE__) |
This is a wrapper for malloc, it allows for extra options such as higher default alignment, memory integrity checks and overflowing into areas other than the heap.
inSize | Size of the block to be allocated. |
Definition at line 155 of file flMemory.h.
Referenced by camCreate(), fileExtension(), fileNameFromPath(), fileOpen(), fontCreateDebug(), fontCreateTexture(), mdl3dAnimLoadMD2(), mdl3dStatLoadOBJ(), mdl3dStatLoadOBJ_faceRead(), memCallocFrom(), mempCreate(), memQallocFrom(), memString(), palCreate(), spriteCreate(), texCreate(), texTreeAdd(), timerCreate(), vmemInit(), and vmemStrideBlockAdd().
#define memAllocUncached | ( | inSize | ) | memAllocUncachedFrom(inSize, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 158 of file flMemory.h.
Referenced by memAllocUncachedFrom(), palCreate(), and texCreate().
#define memCachedPointer | ( | inPtr | ) | memCachedPtr(inPtr); |
Definition at line 258 of file flMemory.h.
#define memCachedPtr | ( | inPtr | ) | ((void*)((unsigned int)(inPtr) & ~MEMORY_UNCACHED_OFFSET)) |
Definition at line 255 of file flMemory.h.
Referenced by graphicsEffectFsColorEnhance(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), memAddressValid(), memBlockValid(), vmemNormalPtr(), and vmemReallocFrom().
#define memCalloc | ( | inSize0, | |||
inSize1 | ) | memCallocFrom(inSize0, inSize1, __FILE__, __FUNCTION__, __LINE__) |
#define memClear | ( | inPtr, | |||
inSize | ) | memClearFrom(inPtr, inSize, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 114 of file flMemory.h.
Referenced by fileOpen(), graphicsInit(), mdl3dStatLoadOBJ_faceRead(), memCallocFrom(), memClearFrom(), mempCalloc(), memTerm(), palCreate(), texCreate(), texCreateBlank(), vmemCallocFrom(), vmemStrideBlockAdd(), and vmemStrideCalloc().
#define memCompare | ( | inSrc0, | |||
inSrc1, | |||||
inSize | ) | memCompareFrom(inSrc0, inSrc1, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define memCopy | ( | inDest, | |||
inSrc, | |||||
inSize | ) | memCopyFrom(inDest, inSrc, inSize, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 115 of file flMemory.h.
Referenced by fileNameFromPath(), fileRead(), fileWrite(), graphicsSwizzleData(), graphicsUnswizzleData(), memCopyFrom(), memInit(), memTerm(), palMoveVMem(), texMoveVMem(), texPixel(), texScreenshot(), and vmemReallocFrom().
#define memErrorBytesCheck | ( | inPtr | ) | memErrorBytesCheckFrom(inPtr, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 220 of file flMemory.h.
Referenced by memErrorBytesCheckFrom(), memFreeFrom(), and memReallocFrom().
#define memFree | ( | inData | ) | memFreeFrom(inData, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 161 of file flMemory.h.
Referenced by camFree(), debugDevWarningFrom(), debugErrorFrom(), debugLog(), debugLogFrom(), debugStatusLogFrom(), debugWarningFrom(), fileClose(), fileDelete(), fileOpen(), fontFree(), graphicsEffectFsDepthFog(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), graphicsSwizzleData(), graphicsTerm(), graphicsUnswizzleData(), mdl3dAnimLoad(), mdl3dAnimLoadMD2(), mdl3dStatFree(), mdl3dStatLoad(), mdl3dStatSave(), memCopyFrom(), memFreeFrom(), mempDestroy(), palCreate(), palFree(), palMoveVMem(), spriteFree(), texCreate(), texFree(), texLoad(), texMoveVMem(), texSave(), timerFree(), vmemStrideBlockDel(), vmemStrideBlockDelRecursive(), and vmemTerm().
#define memIsCachedPointer | ( | inPtr | ) | memIsCachedPtr(inPtr) |
Definition at line 261 of file flMemory.h.
Referenced by graphicsSwizzleData(), graphicsUnswizzleData(), and texLoad().
#define memIsCachedPtr | ( | inPtr | ) | (((unsigned int)(inPtr) & MEMORY_UNCACHED_OFFSET) == 0) |
Definition at line 257 of file flMemory.h.
#define memIsUncachedPointer | ( | inPtr | ) | memIsUncachedPtr(inPtr) |
Definition at line 260 of file flMemory.h.
#define memIsUncachedPtr | ( | inPtr | ) | (((unsigned int)(inPtr) & MEMORY_UNCACHED_OFFSET) != 0) |
Definition at line 256 of file flMemory.h.
#define MEMORY_KERNEL_BASE 0x08000000 |
#define MEMORY_KERNEL_SIZE 0x00800000 |
#define MEMORY_PARTITION_KERNEL1_BASE 0x88000000 |
#define MEMORY_PARTITION_KERNEL1_SIZE 0x00300000 |
#define MEMORY_PARTITION_KERNEL2_BASE 0x88300000 |
#define MEMORY_PARTITION_KERNEL2_SIZE 0x00100000 |
#define MEMORY_PARTITION_KERNEL3_BASE 0x88400000 |
#define MEMORY_PARTITION_KERNEL3_SIZE 0x00400000 |
#define MEMORY_SCRATCHPAD_BASE 0x00010000 |
The start of the scratchpad memory.
Definition at line 23 of file flMemory.h.
Referenced by memAddressValid(), memAlignFrom(), memBlockValid(), memFreeFrom(), memInit(), memQallocFrom(), and memTerm().
#define MEMORY_SCRATCHPAD_SIZE 0x00004000 |
The length of the scratchpad memory.
Definition at line 24 of file flMemory.h.
Referenced by memAddressValid(), memBlockValid(), memFreeFrom(), memInit(), memQallocFrom(), and memTerm().
#define MEMORY_UNCACHED_OFFSET 0x40000000 |
The offset that is added in order to make a pointer uncached.
Definition at line 15 of file flMemory.h.
Referenced by memReallocFrom(), and memUncachedPtrFrom().
#define MEMORY_USER_BASE 0x08800000 |
The start of the user memory.
Definition at line 17 of file flMemory.h.
Referenced by memAddressValid(), and memBlockValid().
#define MEMORY_USER_SIZE 0x01800000 |
The length of the user memory.
Definition at line 18 of file flMemory.h.
Referenced by memAddressValid(), memBlockValid(), and memFreeSpace().
#define memQalloc | ( | inSize | ) | memQallocFrom(inSize, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 157 of file flMemory.h.
Referenced by debugCriticalErrorFrom(), debugDevWarningFrom(), debugErrorFrom(), debugLog(), debugLogFrom(), debugStatusLogFrom(), debugWarningFrom(), fileCopy(), graphicsEffectFsDepthFog(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), graphicsSwizzleData(), graphicsUnswizzleData(), memCopyFrom(), memQallocFrom(), and texLoadPCX().
#define memRealloc | ( | inData, | |||
inSize | ) | memReallocFrom(inData, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define memSetByte | ( | inPtr, | |||
inVal, | |||||
inSize | ) | memSetByteFrom(inPtr, inVal, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define memSetShort | ( | inPtr, | |||
inVal, | |||||
inSize | ) | memSetShortFrom(inPtr, inVal, inSize, __FILE__, __FUNCTION__, __LINE__) |
#define memtAdd | ( | inMemTree, | |||
inPtr, | |||||
inSize, | |||||
inAlignment | ) | memtAddFrom(inMemTree, inPtr, inSize, inAlignment, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 221 of file flMemory.h.
Referenced by memAlignFrom(), memReallocFrom(), and memtAddFrom().
#define memtDel | ( | inMemTree, | |||
inPtr | ) | memtDelFrom(inMemTree, inPtr, __FILE__, __FUNCTION__, __LINE__) |
#define memtErrorBytesCheck | ( | inMemTree | ) | memtErrorBytesCheckFrom(inMemTree, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 223 of file flMemory.h.
Referenced by memAlignFrom(), memClearFrom(), memCompareFrom(), memCopyFrom(), memFreeFrom(), memReallocFrom(), memSetByteFrom(), memSetShortFrom(), and memtErrorBytesCheckFrom().
#define memUncachedPointer | ( | inPtr | ) | memUncachedPtr(inPtr); |
Definition at line 259 of file flMemory.h.
#define memUncachedPtr | ( | inPtr | ) | memUncachedPtrFrom(inPtr, __FILE__, __FUNCTION__, __LINE__) |
Definition at line 162 of file flMemory.h.
Referenced by graphicsEffectFsColorEnhance(), graphicsEffectFsDepthFog(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsGrayscaleSW(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsNightVisionSW(), graphicsEffectFsThermalVision(), memAllocUncachedFrom(), memReallocFrom(), memUncachedPtrFrom(), and vmemInit().
u32 memAddressAlignment | ( | void * | inPtr | ) |
Calculates the largest binary increment that a pointer is aligned to (e.g 16, 32, 64, 128, etc.
).
inPtr | The pointer whose alignment will be calculated. |
Definition at line 912 of file flMemory.c.
Referenced by vmemStrideBlockAdd().
bool memAddressValid | ( | void * | inPtr | ) |
Checks if a pointer resides within valid memory blocks on the terget platform.
inPtr | The pointer whose validity will be checked. |
Definition at line 922 of file flMemory.c.
References memCachedPtr, MEMORY_SCRATCHPAD_BASE, MEMORY_SCRATCHPAD_SIZE, MEMORY_USER_BASE, MEMORY_USER_SIZE, MEMORY_VMEM_BASE, and MEMORY_VMEM_SIZE.
Referenced by memFreeFrom().
void* memAlignFrom | ( | int | inBoundry, | |
int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 702 of file flMemory.c.
References debugWarning, debugWarningFrom(), FL_MEMORY_ALIGNMENT_DEFAULT, memAlign, memErrorTree, MEMORY_SCRATCHPAD_BASE, memScratchpadUsed, memtAdd, memtAddFrom(), memtErrorBytesCheck, memtErrorBytesCheckFrom(), NULL, vmemAlloc, and vmemStrideAlign().
Referenced by memAllocFrom().
void* memAllocFrom | ( | int | inSize, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
This functions is identical to memAlloc() except that it takes extra parameters to define where it was called from,.
inSize | The size of the block to be allocated. | |
inFile | The source file that the original call came from. | |
inFunc | The function that the original call originated from. | |
inLine | The line on which the original call was on. |
Definition at line 511 of file flMemory.c.
References FL_MEMORY_ALIGNMENT_DEFAULT, and memAlignFrom().
Referenced by memCallocFrom().
void* memAllocUncachedFrom | ( | int | inSize, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 577 of file flMemory.c.
References debugWarning, debugWarningFrom(), FL_MEMORY_ALIGNMENT_DEFAULT, max, memAlign, memAllocUncached, memUncachedPtr, and NULL.
bool memBlockValid | ( | void * | inPtr, | |
u32 | inSize | |||
) |
Checks if a memory block resides within valid memory blocks on the terget platform.
inPtr | The pointer to the start of the memory block whose validity will be checked. | |
inSize | The length of the memory block whose validity will be checked. |
Definition at line 933 of file flMemory.c.
References memCachedPtr, MEMORY_SCRATCHPAD_BASE, MEMORY_SCRATCHPAD_SIZE, MEMORY_USER_BASE, MEMORY_USER_SIZE, MEMORY_VMEM_BASE, and MEMORY_VMEM_SIZE.
Referenced by memClearFrom(), memCompareFrom(), memCopyFrom(), memSetByteFrom(), memSetShortFrom(), memtAddFrom(), memtErrorBytesCheckFrom(), and vmemStrideBlockAdd().
void* memCallocFrom | ( | int | inSize0, | |
int | inSize1, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 560 of file flMemory.c.
References memAlloc, memAllocFrom(), memCalloc, memClear, memClearFrom(), and NULL.
void memClearFrom | ( | void * | inPtr, | |
unsigned int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 307 of file flMemory.c.
References debugWarning, debugWarningFrom(), memBlockValid(), memClear, memErrorTree, memtErrorBytesCheck, and memtErrorBytesCheckFrom().
Referenced by memCallocFrom().
int memCompareFrom | ( | void * | inSrc0, | |
void * | inSrc1, | |||
unsigned int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 453 of file flMemory.c.
References debugWarning, debugWarningFrom(), memBlockValid(), memCompare, memErrorTree, memtErrorBytesCheck, and memtErrorBytesCheckFrom().
void memCopyFrom | ( | void * | inDest, | |
void * | inSrc, | |||
unsigned int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 366 of file flMemory.c.
References debugWarning, debugWarningFrom(), memBlockValid(), memCopy, memErrorTree, memFree, memQalloc, memtErrorBytesCheck, and memtErrorBytesCheckFrom().
bool memErrorBytesCheckFrom | ( | void * | inPtr, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 1039 of file flMemory.c.
References debugError, debugErrorFrom(), and memErrorBytesCheck.
void memFreeFrom | ( | void * | inData, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 820 of file flMemory.c.
References debugError, debugErrorFrom(), debugWarning, debugWarningFrom(), memAddressValid(), memErrorBytesCheck, memErrorTree, memFree, MEMORY_SCRATCHPAD_BASE, MEMORY_SCRATCHPAD_SIZE, memScratchpadUsed, memtDel, memtDelFrom(), memtErrorBytesCheck, memtErrorBytesCheckFrom(), vmemFree, vmemFreeFrom(), and vmemPointer.
u32 memFreeSpace | ( | u32 | inAccuracy | ) |
Returns a close estimate of the amount of free space.
inAccuracy | The amount of bytes that the returned answer should be accurate to. |
Definition at line 101 of file flMemory.c.
References MEMORY_USER_SIZE.
Referenced by memFreeSpaceTotal().
u32 memFreeSpaceTotal | ( | ) |
Returns a close estimate of the total amount of free space available to the program on the whole system, this includes video memory, scratchpad and any other memory funcLib can get it's hands on.
Definition at line 128 of file flMemory.c.
References memFreeSpace(), memScratchpadUsed, and vmemFreeSpace().
void memInit | ( | ) |
Called by flInitialize() to initialize the memory system.
Definition at line 28 of file flMemory.c.
References debugError, debugStatusLog, FL_DEBUG_STATUS, memCopy, memInitialized, MEMORY_SCRATCHPAD_BASE, and MEMORY_SCRATCHPAD_SIZE.
Referenced by flInitialize().
void* memQallocFrom | ( | int | inSize, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 521 of file flMemory.c.
References debugWarningFrom(), memAlloc, memInitialized, MEMORY_SCRATCHPAD_BASE, MEMORY_SCRATCHPAD_SIZE, memQalloc, memScratchpadUsed, vmemAlloc, and vmemInitialized.
void* memReallocFrom | ( | void * | inData, | |
int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 608 of file flMemory.c.
References debugError, debugErrorFrom(), debugWarning, debugWarningFrom(), memErrorBytesCheck, memErrorTree, MEMORY_UNCACHED_OFFSET, memRealloc, memtAdd, memtAddFrom(), memtErrorBytesCheck, memtErrorBytesCheckFrom(), memUncachedPtr, NULL, vmemPointer, and vmemRealloc.
void memSetByteFrom | ( | void * | inPtr, | |
int | inVal, | |||
unsigned int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 175 of file flMemory.c.
References debugWarning, debugWarningFrom(), memBlockValid(), memErrorTree, memSetByte, memtErrorBytesCheck, and memtErrorBytesCheckFrom().
void memSetShortFrom | ( | void * | inPtr, | |
int | inVal, | |||
unsigned int | inSize, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 240 of file flMemory.c.
References debugWarning, debugWarningFrom(), memBlockValid(), memErrorTree, memSetShort, memtErrorBytesCheck, and memtErrorBytesCheckFrom().
char* memString | ( | u32 | inBytes, | |
bool | inBinary | |||
) |
Converts an amount of bytes into a more humanly readable string to be printed in a log or to the screen.
inBytes | The amount of bytes. | |
inBinary | If set to true then it will return binary results where there are 1024 bytes in a Kilobyte (and append e.g. "KiB"), if not then a KiloByte will be considered 1000 bytes (and e.g "KB" will be printed). |
Definition at line 137 of file flMemory.c.
References memAlloc.
void memtAddFrom | ( | MemoryTree ** | inMemTree, | |
void * | inPtr, | |||
u32 | inSize, | |||
u32 | inAlignment, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 1083 of file flMemory.c.
References debugError, debugErrorFrom(), memBlockValid(), memtAdd, MemoryTree::memtAlignment, MemoryTree::memtData, MemoryTree::memtNext, MemoryTree::memtSize, and NULL.
Referenced by memAlignFrom(), and memReallocFrom().
void memtDelFrom | ( | MemoryTree ** | inMemTree, | |
void * | inPtr, | |||
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 1151 of file flMemory.c.
References debugError, debugErrorFrom(), flRunning, MemoryTree::memtData, memtDel, MemoryTree::memtNext, and NULL.
Referenced by memFreeFrom().
void memTerm | ( | ) |
Called by flTerminate() to deinitialize the memory system.
Definition at line 72 of file flMemory.c.
References debugStatusLog, fileDelete(), FL_MEMORY_PAGE_PATH, memClear, memCopy, memInitialized, MEMORY_SCRATCHPAD_BASE, and MEMORY_SCRATCHPAD_SIZE.
Referenced by flTerminate().
void memtErrorBytesCheckFrom | ( | MemoryTree ** | inMemTree, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 1196 of file flMemory.c.
References debugError, debugErrorFrom(), debugWarning, debugWarningFrom(), FL_DEBUG_CALLEDFROM, FL_DEBUG_ERROR, memBlockValid(), MemoryTree::memtAlignment, MemoryTree::memtData, memtErrorBytesCheck, MemoryTree::memtNext, and MemoryTree::memtSize.
Referenced by memAlignFrom(), memClearFrom(), memCompareFrom(), memCopyFrom(), memFreeFrom(), memReallocFrom(), memSetByteFrom(), and memSetShortFrom().
void* memUncachedPtrFrom | ( | void * | inPtr, | |
const char * | inFile, | |||
const char * | inFunc, | |||
int | inLine | |||
) |
Definition at line 894 of file flMemory.c.
References debugWarning, debugWarningFrom(), MEMORY_UNCACHED_OFFSET, memUncachedPtr, and NULL.
Definition at line 22 of file flMemory.c.
Referenced by memAlignFrom(), memClearFrom(), memCompareFrom(), memCopyFrom(), memFreeFrom(), memReallocFrom(), memSetByteFrom(), and memSetShortFrom().
A boolean to represent whether the memory system has been initialized or not, this is set by memInit() and memTerm().
Definition at line 25 of file flMemory.c.
Referenced by memInit(), memQallocFrom(), and memTerm().
A boolean to represent whether the scratchpad is currently in use or not, this allows the fastest possible allocation/free'ing of memory for temp data.
Definition at line 26 of file flMemory.c.
Referenced by memAlignFrom(), memFreeFrom(), memFreeSpaceTotal(), and memQallocFrom().