REpsp2
PSP2 OS reverse engineering
Loading...
Searching...
No Matches
Object Heap

Data Structures

struct  ObjectHeap

Functions

void ObjectHeap_init (ObjectHeap *pObjectHeap, SceKernelPhyMemPart *pPhyMemPart, SceUInt32 num_heaps, struct HeapDescriptor *heaps, SceKernelHeapHook *pHeapHook)
void ObjectHeap_set_heap_for_size (ObjectHeap *pObjectHeap, SceSize itemSize, SceUIDHeap *pHeap, int heapGuid)
SceUIDHeapObjectHeapGetHeap (ObjectHeap *pObjectHeap, SceSize size)
 Get appropriate heap for allocations of given size.
SceInt32 ObjectHeapSetResourceLimit (ObjectHeap *pObjectHeap, SceUInt32 resourceType, SceInt32 nMaxLimit, SceSize max_cache_size)
void * ObjectHeap_get_unk18 (ObjectHeap *pObjectHeap)
SceBool ObjectHeapAllocLimit (ObjectHeap *pObjectHeap, SceUInt32 type, ScePVoid *ppObject)
 Allocate resource from object heap with limit checking.
SceBool ObjectHeapFree (ObjectHeap *pObjectHeap, SceUInt32 type, ScePVoid pObject)
 Attempt freeing memory into object heap.
ObjectHeapget_kernel_objectheap (void)
 Obtain pointer to the kernel's object heap.
SceInt32 sceKernelCreateObjectHeap (ScePID processId, int a2, SceKernelHeapHook *pHeapHook, ObjectHeap **ppObjectHeap)
 Create an object heap.
SceInt32 sceKernelObjectHeapStart (ObjectHeap *pObjectHeap, int a2, unsigned a3)
SceInt32 sce_KernelDeleteObjectHeap (ObjectHeap *pObjectHeap)
 Delete an object heap.
SceInt32 sceKernelObjectHeap_setResourceSize (SceUInt32 type, SceSize size)
 Set size of resources of a given type in object heap.
SceInt32 sceKernelObjectHeapSetResourceLimit (ObjectHeap *pObjectHeap, SceUInt32 resourceType, SceInt32 nMaxLimit, SceSize max_cache_size)
 Set limit for specific resource in object heap.
SceInt32 sceKernelObjectHeapSetResourceLimitAll (ObjectHeap *pObjectHeap, unsigned a2, const void *a3)
 Set limit for "all" resource types in an object heap.
ScePVoid sceKernelObjectHeapAlloc (ObjectHeap *pObjectHeap, SceSize size)
 Allocate memory from an object heap.
SceInt32 sceKernelObjectHeapFree (ObjectHeap *pObjectHeap, SceSize size, ScePVoid ptr)
 Free memory allocated from an object heap.

Detailed Description

Object Heaps are per-process objects used to perform memory allocations. They are used to ensure a process cannot allocate more resources of a certain type than allowed by a configurable limit. Under the hood, memory is allocated from one of various heaps (usually(?) per-process).

The Object Heap also implements a memory re-use mechanism which retains the allocations of a configurable amount of objects in a freelist, such that allocations can be serviced without calling the underlying heaps.

Function Documentation

◆ get_kernel_objectheap()

ObjectHeap * get_kernel_objectheap ( void )

Obtain pointer to the kernel's object heap.

Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0x857408DA

◆ ObjectHeap_get_unk18()

void * ObjectHeap_get_unk18 ( ObjectHeap * pObjectHeap)
Todo
documentation

◆ ObjectHeap_init()

void ObjectHeap_init ( ObjectHeap * pObjectHeap,
SceKernelPhyMemPart * pPhyMemPart,
SceUInt32 num_heaps,
struct HeapDescriptor * heaps,
SceKernelHeapHook * pHeapHook )
Todo
documentation + maybe this is private?

◆ ObjectHeap_set_heap_for_size()

void ObjectHeap_set_heap_for_size ( ObjectHeap * pObjectHeap,
SceSize itemSize,
SceUIDHeap * pHeap,
int heapGuid )
Todo
documentation + maybe this is private?

◆ ObjectHeapAllocLimit()

SceBool ObjectHeapAllocLimit ( ObjectHeap * pObjectHeap,
SceUInt32 type,
ScePVoid * ppObject )

Allocate resource from object heap with limit checking.

Parameters
pObjectHeapTarget object heap
typeResource type
[out]ppObjectPointer receiving pointer to allocated memory
Return values
SCE_TRUEResource allocation successful
SCE_FALSEResource allocation failed (object limit overflow)
Note
When SCE_TRUE is returned, *ppObject may be NULL; in such cases, the caller must perform the allocation using UIDHeapCallAlloc.

◆ ObjectHeapFree()

SceBool ObjectHeapFree ( ObjectHeap * pObjectHeap,
SceUInt32 type,
ScePVoid pObject )

Attempt freeing memory into object heap.

Parameters
pObjectHeapTarget object heap
typeResource type
pObjectPointer to memory
Return values
SCE_TRUEResource has been free'ed (added to object heap freelist)
SCE_FALSEResource has been ignored When this value is returned, the caller should call UIDHeapCallFree on the appropriate heap to release the resource.

◆ ObjectHeapGetHeap()

SceUIDHeap * ObjectHeapGetHeap ( ObjectHeap * pObjectHeap,
SceSize size )

Get appropriate heap for allocations of given size.

Parameters
pObjectHeapTarget object heap
sizeSize to allocate
Return values
Non-NULLHeap from which memory can be allocated
NULLNo appropriate heap found

◆ ObjectHeapSetResourceLimit()

SceInt32 ObjectHeapSetResourceLimit ( ObjectHeap * pObjectHeap,
SceUInt32 resourceType,
SceInt32 nMaxLimit,
SceSize max_cache_size )
Todo
documentation

◆ sce_KernelDeleteObjectHeap()

SceInt32 sce_KernelDeleteObjectHeap ( ObjectHeap * pObjectHeap)

Delete an object heap.

Parameters
pObjectHeapTarget object heap
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0x2F526AB8

◆ sceKernelCreateObjectHeap()

SceInt32 sceKernelCreateObjectHeap ( ScePID processId,
int a2,
SceKernelHeapHook * pHeapHook,
ObjectHeap ** ppObjectHeap )

Create an object heap.

Parameters
processIdObject heap owner PID
a2
pHeapHookHeap operations hook
ppObjectHeapReceives pointer to created object heap
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0x9D8F3BE8
Note
This function's name is official.
Name of argument 3 is official.

◆ sceKernelObjectHeap_setResourceSize()

SceInt32 sceKernelObjectHeap_setResourceSize ( SceUInt32 type,
SceSize size )

Set size of resources of a given type in object heap.

Parameters
type
size
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0xB591E49F
Note
this affects all object heaps globally - but how exactly?
Warning
This is work in progress!

◆ sceKernelObjectHeapAlloc()

ScePVoid sceKernelObjectHeapAlloc ( ObjectHeap * pObjectHeap,
SceSize size )

Allocate memory from an object heap.

Parameters
pObjectHeapObject heap to allocate from
sizeSize of memory to allocate
Returns
Non-NULL pointer on success, NULL on failure
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0xEBFC8E10
Note
This function's name is official.

◆ sceKernelObjectHeapFree()

SceInt32 sceKernelObjectHeapFree ( ObjectHeap * pObjectHeap,
SceSize size,
ScePVoid ptr )

Free memory allocated from an object heap.

Parameters
pObjectHeapObject heap from which memory comes
sizeSize of allocated memory
ptrPointer to allocated memory
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0x17D3D4BD

Definition at line 56 of file oheap.c.

◆ sceKernelObjectHeapSetResourceLimit()

SceInt32 sceKernelObjectHeapSetResourceLimit ( ObjectHeap * pObjectHeap,
SceUInt32 resourceType,
SceInt32 nMaxLimit,
SceSize max_cache_size )

Set limit for specific resource in object heap.

Parameters
pObjectHeapTarget object heap
resourceTypeTarget resource type
nMaxLimitMaximum number of allocations for resource type
max_cache_sizeMaximum cache size for the resource type This is the number of free()'ed items kept allocated in a freelist instead of releasing the memory back to the underlying heap.
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0xDFA1EB57
Note
This function's name is official.

◆ sceKernelObjectHeapSetResourceLimitAll()

SceInt32 sceKernelObjectHeapSetResourceLimitAll ( ObjectHeap * pObjectHeap,
unsigned a2,
const void * a3 )

Set limit for "all" resource types in an object heap.

Parameters
pObjectHeapTarget object heap
a2Maximal resource type index on which limits are set
a3Resource limits information
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0x067F2550
Note
This function's name is official.
Warning
This is work in progress!

◆ sceKernelObjectHeapStart()

SceInt32 sceKernelObjectHeapStart ( ObjectHeap * pObjectHeap,
int a2,
unsigned a3 )
Parameters
pObjectHeap
a2
a3
Return values
SCE_OKSuccess
<SCE_OKError code
Exported by SceSysmemForKernel
Old NID: 0x?
New NID: 0x660DC18A
Note
This function's name is official.
Warning
This is work in progress!