PS2SDK
PS2 Homebrew Libraries
sysmem.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
#ifndef __SYSMEM_H__
17
#define __SYSMEM_H__
18
19
#include <types.h>
20
#include <
irx.h
>
21
#include <stdarg.h>
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
// Allocation strategies
28
#define ALLOC_FIRST 0
29
#define ALLOC_LAST 1
30
#define ALLOC_ADDRESS 2
31
32
// see QueryBlockTopAddress, QueryBlockSize
33
#define USED 0x00000000
34
#define FREE 0x80000000
35
36
typedef
struct
sysmem_alloc_block_info_
37
{
38
u32 m_allocated : 1;
39
u32 m_address : 15;
40
u32 m_pad : 1;
41
u32 m_size : 15;
42
}
sysmem_alloc_block_info_t
;
43
44
typedef
struct
sysmem_alloc_block_
45
{
46
struct
sysmem_alloc_block_
*m_next;
47
sysmem_alloc_block_info_t
m_info;
48
}
sysmem_alloc_block_t
;
49
50
typedef
struct
sysmem_alloc_table_
51
{
52
struct
sysmem_alloc_table_
*m_next;
53
sysmem_alloc_block_t
m_blkarray[31];
54
int
m_padding;
55
}
sysmem_alloc_table_t
;
56
58
typedef
struct
sysmem_internals_
59
{
60
int
m_memsize;
61
sysmem_alloc_table_t
*m_alloclist;
62
/* The following members may change depending on the version of the module. */
63
void
*m_intr_suspend_tbl;
64
int
m_allocation_count;
65
sysmem_alloc_table_t
*m_smemupdate_cur;
66
}
sysmem_internals_t
;
67
68
extern
sysmem_internals_t
*GetSysmemInternalData(
void
);
69
70
extern
void
* AllocSysMemory(
int
mode,
int
size,
void
*ptr);
71
72
extern
int
FreeSysMemory(
void
*ptr);
73
74
extern
u32 QueryMemSize();
75
// In liberx, the following is QueryFreeMemSize
76
extern
u32 QueryMaxFreeMemSize();
77
extern
u32 QueryTotalFreeMemSize();
78
// In liberx, the following is QueryBlockInfo
79
extern
void
* QueryBlockTopAddress(
void
*address);
80
extern
int
QueryBlockSize(
void
*address);
81
82
typedef
int (KprintfHandler_t)(
void
*context,
const
char
*format, va_list ap);
83
84
extern
int
Kprintf(
const
char
*format,...);
85
extern
void
KprintfSet(KprintfHandler_t *,
void
*context);
86
87
#define sysmem_IMPORTS_start DECLARE_IMPORT_TABLE(sysmem, 1, 1)
88
#define sysmem_IMPORTS_end END_IMPORT_TABLE
89
90
#define I_GetSysmemInternalData DECLARE_IMPORT(3, GetSysmemInternalData)
91
#define I_AllocSysMemory DECLARE_IMPORT(4, AllocSysMemory)
92
#define I_FreeSysMemory DECLARE_IMPORT(5, FreeSysMemory)
93
#define I_QueryMemSize DECLARE_IMPORT(6, QueryMemSize)
94
#define I_QueryMaxFreeMemSize DECLARE_IMPORT(7, QueryMaxFreeMemSize)
95
#define I_QueryTotalFreeMemSize DECLARE_IMPORT(8, QueryTotalFreeMemSize)
96
#define I_QueryBlockTopAddress DECLARE_IMPORT(9, QueryBlockTopAddress)
97
#define I_QueryBlockSize DECLARE_IMPORT(10, QueryBlockSize)
98
#define I_Kprintf DECLARE_IMPORT(14, Kprintf)
99
#define I_KprintfSet DECLARE_IMPORT(15, KprintfSet)
100
101
#ifdef __cplusplus
102
}
103
#endif
104
105
#endif
/* IOP_SYSMEM_H */
sysmem_alloc_block_
Definition:
sysmem.h:44
sysmem_alloc_table_
Definition:
sysmem.h:50
sysmem_alloc_block_info_
Definition:
sysmem.h:36
irx.h
sysmem_internals_
Definition:
sysmem.h:58
sysmem_internals_t
struct sysmem_internals_ sysmem_internals_t
iop
system
sysmem
include
sysmem.h
Generated on Tue Oct 6 2026 23:20:14 for PS2SDK by
1.8.17