SSBM Decomp
Loading...
Searching...
No Matches
OSAlloc.h
Go to the documentation of this file.
1#ifndef __DOLPHIN_OSALLOC_H_
2#define __DOLPHIN_OSALLOC_H_
3
4#include <platform.h>
5
6typedef struct _HeapCell {
7 struct _HeapCell* prev;
8 struct _HeapCell* next;
9 size_t size;
10} HeapCell;
11
12typedef struct _Heap {
14 struct _HeapCell* free; // linked list of free cells
15 struct _HeapCell* allocated; // linked list of allocated cells
16} Heap;
17
18typedef int OSHeapHandle;
19
20extern volatile OSHeapHandle __OSCurrHeap;
21
22void* OSInitAlloc(void*, void*, int);
23OSHeapHandle OSCreateHeap(void*, void*);
24void OSDestroyHeap(size_t idx);
26void* OSAllocFromHeap(OSHeapHandle heap, size_t size);
28void OSFreeToHeap(OSHeapHandle heap, void* ptr);
29
30#define OSAlloc(size) OSAllocFromHeap(__OSCurrHeap, (size))
31#define OSFree(ptr) OSFreeToHeap(__OSCurrHeap, (ptr))
32
33#endif
volatile OSHeapHandle __OSCurrHeap
Definition OSAlloc.c:10
OSHeapHandle OSCreateHeap(void *, void *)
Definition OSAlloc.c:188
void * OSAllocFromHeap(OSHeapHandle heap, size_t size)
Definition OSAlloc.c:87
void * OSInitAlloc(void *, void *, int)
Definition OSAlloc.c:162
size_t OSCheckHeap(OSHeapHandle)
Definition OSAlloc.c:215
int OSHeapHandle
Definition OSAlloc.h:18
OSHeapHandle OSSetCurrentHeap(OSHeapHandle)
Definition OSAlloc.c:154
void OSDestroyHeap(size_t idx)
Definition OSAlloc.c:210
void OSFreeToHeap(OSHeapHandle heap, void *ptr)
Definition OSAlloc.c:133
void * ptr
Definition __types.h:6
signed long s32
A signed 32-bit integer.
Definition platform.h:14
Definition OSAlloc.h:6
struct _HeapCell * prev
Definition OSAlloc.h:7
struct _HeapCell * next
Definition OSAlloc.h:8
size_t size
Definition OSAlloc.h:9
Definition OSAlloc.h:12
struct _HeapCell * free
Definition OSAlloc.h:14
s32 size
Definition OSAlloc.h:13
struct _HeapCell * allocated
Definition OSAlloc.h:15