gwnavruntime/kernel/HeapPT/HeapPT_SysAllocMapper.h Source File
Go to the documentation of this file.
19 #ifndef INC_KY_Kernel_HeapPT_SysAllocMapper_H
20 #define INC_KY_Kernel_HeapPT_SysAllocMapper_H
50 class SysAllocMapper :
public SysAllocPaged
59 enum { MaxSegments = 32 };
63 SysAllocMapper(SysMemMapper* mapper, UPInt segSize,
64 UPInt granularity,
bool bestFit =
true);
66 virtual void GetInfo(Info* i)
const;
67 virtual void* Alloc(UPInt size, UPInt align);
68 virtual bool ReallocInPlace(
void* oldPtr, UPInt oldSize, UPInt newSize, UPInt align);
69 virtual bool Free(
void* ptr, UPInt size, UPInt align);
71 virtual UPInt GetFootprint()
const {
return Footprint; }
72 virtual UPInt GetUsedSpace()
const {
return Footprint; }
74 const UInt32* GetBitSet(UPInt numSeg)
const
76 if (numSeg >= NumSegments)
80 return (
const UInt32*)(Segments[numSeg].Memory + SegmSize - PageSize);
83 virtual UPInt GetBase()
const;
86 UPInt getBitSize(UPInt size)
const;
87 UInt32* getBitSet(
const UByte* start, UPInt size)
const;
88 UPInt getEndBit(UPInt size)
const;
89 UByte* getAlignedPtr(
const UByte* ptr, UPInt alignment)
const;
90 bool alignmentIsOK(
const UByte* ptr, UPInt size, UPInt alignment, UPInt limit)
const;
91 void* allocMem(UPInt pos, UPInt size, UPInt alignment);
92 void* allocMem(UPInt size, UPInt alignment);
93 UPInt freeMem(
void* ptr, UPInt size);
95 bool inRange(
const UByte* ptr,
const Segment* seg)
const;
96 UPInt binarySearch(
const UByte* ptr)
const;
97 UPInt findSegment(
const UByte* ptr)
const;
98 bool reserveSegment(UPInt size);
99 void releaseSegment(UPInt pos);
101 SysMemMapper* pMapper;
107 Segment Segments[MaxSegments];
Definition: gamekitcrowddispersion.h:20