PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
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
24extern "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
37{
38 struct sysmem_alloc_element_ *next;
39 unsigned int info;
41
42typedef struct sysmem_alloc_table_
43{
44 struct sysmem_alloc_table_ *next;
46 int padding;
48
50typedef struct sysmem_internals_
51{
52 int memsize;
53 sysmem_alloc_table_t *alloclist;
54 /* The following members may change depending on the version of the module. */
55 void *intr_suspend_tbl;
56 int allocation_count;
57 sysmem_alloc_table_t *smemupdate_cur;
59
60sysmem_internals_t *GetSysmemInternalData(void);
61
62void * AllocSysMemory(int mode, int size, void *ptr);
63
64int FreeSysMemory(void *ptr);
65
66u32 QueryMemSize();
67// In liberx, the following is QueryFreeMemSize
68u32 QueryMaxFreeMemSize();
69u32 QueryTotalFreeMemSize();
70// In liberx, the following is QueryBlockInfo
71void * QueryBlockTopAddress(void *address);
72int QueryBlockSize(void *address);
73
74typedef int (KprintfHandler_t)(void *context, const char *format, va_list ap);
75
76int Kprintf(const char *format,...);
77void KprintfSet(KprintfHandler_t *, void *context);
78
79#define sysmem_IMPORTS_start DECLARE_IMPORT_TABLE(sysmem, 1, 1)
80#define sysmem_IMPORTS_end END_IMPORT_TABLE
81
82#define I_GetSysmemInternalData DECLARE_IMPORT(3, GetSysmemInternalData)
83#define I_AllocSysMemory DECLARE_IMPORT(4, AllocSysMemory)
84#define I_FreeSysMemory DECLARE_IMPORT(5, FreeSysMemory)
85#define I_QueryMemSize DECLARE_IMPORT(6, QueryMemSize)
86#define I_QueryMaxFreeMemSize DECLARE_IMPORT(7, QueryMaxFreeMemSize)
87#define I_QueryTotalFreeMemSize DECLARE_IMPORT(8, QueryTotalFreeMemSize)
88#define I_QueryBlockTopAddress DECLARE_IMPORT(9, QueryBlockTopAddress)
89#define I_QueryBlockSize DECLARE_IMPORT(10, QueryBlockSize)
90#define I_Kprintf DECLARE_IMPORT(14, Kprintf)
91#define I_KprintfSet DECLARE_IMPORT(15, KprintfSet)
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif /* IOP_SYSMEM_H */
struct sysmem_internals_ sysmem_internals_t