PSPSDK 2026-11-05
Unofficial static mirror · snapshot 2026-11-05 · upstream documentation
Loading...
Searching...
No Matches
System Memory Manager Kernel

This module contains routines to manage heaps of memory. More...

Data Structures

struct  _PspSysmemPartitionInfo
 
struct  SceGameInfo
 
struct  _uidControlBlock
 Structure of a UID control block. More...
 
struct  SceSysmemPartInfo
 
struct  SceSysmemPartTable
 
struct  PspPartitionData
 
struct  PspSysMemPartition
 

Typedefs

typedef struct _PspSysmemPartitionInfo PspSysmemPartitionInfo
 
typedef struct SceGameInfo SceGameInfo
 
typedef struct _uidControlBlock SceUidControlBlock
 
typedef struct _uidControlBlock uidControlBlock
 
typedef struct PspPartitionData PspPartitionData
 
typedef struct PspSysMemPartition PspSysMemPartition
 
typedef int(* SceGetIdFunc) (const char *path, char *id)
 

Functions

int sceKernelQueryMemoryPartitionInfo (int pid, PspSysmemPartitionInfo *info)
 Query the parition information.
 
SceSize sceKernelPartitionTotalFreeMemSize (int pid)
 Get the total amount of free memory.
 
SceSize sceKernelPartitionMaxFreeMemSize (int pid)
 Get the size of the largest free memory block.
 
void sceKernelSysMemDump (void)
 Get the kernel to dump the internal memory table to Kprintf.
 
void sceKernelSysMemDumpBlock (void)
 Dump the list of memory blocks.
 
void sceKernelSysMemDumpTail (void)
 Dump the tail blocks.
 
int sceKernelSetDdrMemoryProtection (void *addr, int size, int prot)
 Set the protection of a block of ddr memory.
 
SceUID sceKernelCreateHeap (SceUID partitionid, SceSize size, int unk, const char *name)
 Create a heap.
 
void * sceKernelAllocHeapMemory (SceUID heapid, SceSize size)
 Allocate a memory block from a heap.
 
int sceKernelFreeHeapMemory (SceUID heapid, void *block)
 Free a memory block allocated from a heap.
 
int sceKernelDeleteHeap (SceUID heapid)
 Delete a heap.
 
SceSize sceKernelHeapTotalFreeSize (SceUID heapid)
 Get the amount of free size of a heap, in bytes.
 
int sceKernelGetSceUidControlBlock (SceUID uid, SceUidControlBlock **block)
 Get a UID control block.
 
int sceKernelGetSceUidControlBlockWithType (SceUID uid, SceUidControlBlock *type, SceUidControlBlock **block)
 Get a UID control block on a particular type.
 
SceUidControlBlock * sceKernelGetUidmanCB (void)
 Get the root of the UID tree (1.5+ only)
 
int sceKernelDeleteUID (SceUID uid)
 Delete a UID.
 
int sceKernelGetModel (void)
 Get the model of PSP.
 
int sceKernelSetCompiledSdkVersion (int version)
 Set the version of the SDK with which the caller was compiled.
 
int sceKernelGetCompiledSdkVersion (void)
 Get the SDK version set with sceKernelSetCompiledSdkVersion().
 
SceGameInfo * sceKernelGetGameInfo ()
 Gets the information of the game.
 
int sceKernelGetSystemStatus (void)
 Gets the current status of the system.
 
int sceKernelGetUIDcontrolBlock (SceUID uid, SceUidControlBlock **block)
 Get a UID control block.
 
int sceKernelGetQTGP2 (u8 *qtgp2)
 Gets the QTGP2 value.
 
int sceKernelSetQTGP2 (const u8 *qtgp2)
 Sets the QTGP2 value on the global game information.
 
int sceKernelGetQTGP3 (u8 *qtgp3)
 Gets the QTGP3 value.
 
int sceKernelSetQTGP3 (const u8 *qtgp3)
 Sets the QTGP3 value on the global game information.
 
int sceKernelRegisterGetIdFunc (SceGetIdFunc func)
 Registers a get ID function, that will be used on sceKernelGetId.
 
int sceKernelGetId (const char *path, char *id)
 Calls the registered get ID function with [sceKernelRegisterGetIdFunc], and then unregisters it.
 

Detailed Description

This module contains routines to manage heaps of memory.

Typedef Documentation

◆ PspPartitionData

typedef struct PspPartitionData PspPartitionData

◆ PspSysMemPartition

typedef struct PspSysMemPartition PspSysMemPartition

◆ PspSysmemPartitionInfo

◆ SceGameInfo

typedef struct SceGameInfo SceGameInfo

◆ SceGetIdFunc

typedef int(* SceGetIdFunc) (const char *path, char *id)

◆ SceUidControlBlock

◆ uidControlBlock

Function Documentation

◆ sceKernelAllocHeapMemory()

void * sceKernelAllocHeapMemory ( SceUID heapid,
SceSize size )

Allocate a memory block from a heap.

Parameters
heapid- The UID of the heap to allocate from.
size- The number of bytes to allocate.
Returns
The address of the allocated memory block, or NULL on error.

◆ sceKernelCreateHeap()

SceUID sceKernelCreateHeap ( SceUID partitionid,
SceSize size,
int unk,
const char * name )

Create a heap.

Parameters
partitionid- The UID of the partition where allocate the heap.
size- The size in bytes of the heap.
unk- Unknown, probably some flag or type, pass 1.
name- Name assigned to the new heap.
Returns
The UID of the new heap, or if less than 0 an error.

◆ sceKernelDeleteHeap()

int sceKernelDeleteHeap ( SceUID heapid)

Delete a heap.

Parameters
heapid- The UID of the heap to delete.
Returns
0 on success, < 0 on error.

◆ sceKernelDeleteUID()

int sceKernelDeleteUID ( SceUID uid)

Delete a UID.

Parameters
uid- The UID to delete
Returns
0 on success

◆ sceKernelFreeHeapMemory()

int sceKernelFreeHeapMemory ( SceUID heapid,
void * block )

Free a memory block allocated from a heap.

Parameters
heapid- The UID of the heap where block belongs.
block- The block of memory to free from the heap.
Returns
0 on success, < 0 on error.

◆ sceKernelGetCompiledSdkVersion()

int sceKernelGetCompiledSdkVersion ( void )

Get the SDK version set with sceKernelSetCompiledSdkVersion().

Returns
Version number, or 0 if unset.

◆ sceKernelGetGameInfo()

SceGameInfo * sceKernelGetGameInfo ( )

Gets the information of the game.

(2.00+ ?)

Returns
Pointer to the game information on success. NULL otherwise.
Attention
Needs to link to pspsysmem_kernel stub.

◆ sceKernelGetId()

int sceKernelGetId ( const char * path,
char * id )

Calls the registered get ID function with [sceKernelRegisterGetIdFunc], and then unregisters it.

Parameters
[in]pathThe path to pass to the registered function.
[out]idA pointer to be passed to the registered function to receive the ID.
Returns
0 on success, < 0 otherwise.
Attention
This API is available from 3.00 and forward.

◆ sceKernelGetModel()

int sceKernelGetModel ( void )

Get the model of PSP.

Returns
<= 0 original, 1 slim

◆ sceKernelGetQTGP2()

int sceKernelGetQTGP2 ( u8 * qtgp2)

Gets the QTGP2 value.

Parameters
[out]qtgp2A pointer to a buffer to receive the qtgp2 value. The buffer must be at least 8 bytes in size.
Returns
0 on success, < 0 otherwise.
Attention
This API is available from 2.00 and forward.

◆ sceKernelGetQTGP3()

int sceKernelGetQTGP3 ( u8 * qtgp3)

Gets the QTGP3 value.

Parameters
[out]qtgp3A pointer to a buffer to receive the qtgp3 value. The buffer must be at least 16 bytes in size.
Returns
0 on success, < 0 otherwise.
Attention
This API is available from 2.00 and forward.

◆ sceKernelGetSceUidControlBlock()

int sceKernelGetSceUidControlBlock ( SceUID uid,
SceUidControlBlock ** block )

Get a UID control block.

Parameters
uid- The UID to find
block- Pointer to hold the pointer to the block
Returns
0 on success

◆ sceKernelGetSceUidControlBlockWithType()

int sceKernelGetSceUidControlBlockWithType ( SceUID uid,
SceUidControlBlock * type,
SceUidControlBlock ** block )

Get a UID control block on a particular type.

Parameters
uid- The UID to find
type- Pointer to the type UID block
block- Pointer to hold the pointer to the block
Returns
0 on success

◆ sceKernelGetSystemStatus()

int sceKernelGetSystemStatus ( void )

Gets the current status of the system.

Returns
The status of the system.
Attention
Needs to link to pspsysmem_kernel stub.

◆ sceKernelGetUIDcontrolBlock()

int sceKernelGetUIDcontrolBlock ( SceUID uid,
SceUidControlBlock ** block )

Get a UID control block.

Parameters
uid- The UID to find
block- Pointer to hold the pointer to the block
Returns
0 on success
Attention
Needs to link to pspsysmem_kernel stub.

◆ sceKernelGetUidmanCB()

SceUidControlBlock * sceKernelGetUidmanCB ( void )

Get the root of the UID tree (1.5+ only)

Returns
Pointer to the UID tree root

◆ sceKernelHeapTotalFreeSize()

SceSize sceKernelHeapTotalFreeSize ( SceUID heapid)

Get the amount of free size of a heap, in bytes.

Parameters
heapid- The UID of the heap
Returns
the free size of the heap, in bytes. < 0 on error.

◆ sceKernelPartitionMaxFreeMemSize()

SceSize sceKernelPartitionMaxFreeMemSize ( int pid)

Get the size of the largest free memory block.

Parameters
pid- The partition id
Returns
The size of the largest free memory block, in bytes.

◆ sceKernelPartitionTotalFreeMemSize()

SceSize sceKernelPartitionTotalFreeMemSize ( int pid)

Get the total amount of free memory.

Parameters
pid- The partition id
Returns
The total amount of free memory, in bytes.

◆ sceKernelQueryMemoryPartitionInfo()

int sceKernelQueryMemoryPartitionInfo ( int pid,
PspSysmemPartitionInfo * info )

Query the parition information.

Parameters
pid- The partition id
info- Pointer to the PspSysmemPartitionInfo structure
Returns
0 on success.

◆ sceKernelRegisterGetIdFunc()

int sceKernelRegisterGetIdFunc ( SceGetIdFunc func)

Registers a get ID function, that will be used on sceKernelGetId.

Parameters
funcThe function pointer to register.
Returns
0 on success, < 0 otherwise.
Attention
This API is available from 3.00 and forward.

◆ sceKernelSetCompiledSdkVersion()

int sceKernelSetCompiledSdkVersion ( int version)

Set the version of the SDK with which the caller was compiled.

Version numbers are as for sceKernelDevkitVersion().

Returns
0 on success, < 0 on error.

◆ sceKernelSetDdrMemoryProtection()

int sceKernelSetDdrMemoryProtection ( void * addr,
int size,
int prot )

Set the protection of a block of ddr memory.

Parameters
addr- Address to set protection on
size- Size of block
prot- Protection bitmask
Returns
< 0 on error

◆ sceKernelSetQTGP2()

int sceKernelSetQTGP2 ( const u8 * qtgp2)

Sets the QTGP2 value on the global game information.

Parameters
[in]qtgp2A pointer to the QTGP2 value to set. 8 bytes buffer.
Returns
0 on success, < 0 otherwise.
Attention
This API is available from 2.00 and forward.

◆ sceKernelSetQTGP3()

int sceKernelSetQTGP3 ( const u8 * qtgp3)

Sets the QTGP3 value on the global game information.

Parameters
[in]qtgp3A pointer to the QTGP3 value to set. 16 bytes buffer.
Returns
0 on success, < 0 otherwise.
Attention
This API is available from 2.00 and forward.

◆ sceKernelSysMemDump()

void sceKernelSysMemDump ( void )

Get the kernel to dump the internal memory table to Kprintf.

◆ sceKernelSysMemDumpBlock()

void sceKernelSysMemDumpBlock ( void )

Dump the list of memory blocks.

◆ sceKernelSysMemDumpTail()

void sceKernelSysMemDumpTail ( void )

Dump the tail blocks.