Files
tp/include/dolphin/os/OSAlloc.h
T
TakaRikka 1114b13da8 clean up dolphin files / work on some rels (#212)
* d_a_alldie / d_a_tboxSw / d_a_tag_gstart / d_a_tag_hstop

* dolphin OS work / cleanup

* dolphin GX work / cleanup

* finish changing dolphin files to C

* more files into C

* match rest of MSL_C math functions

* more dolphin files converted to C

* remove asm

* d_bg_w work

* remove asm

* d_a_alink work / kytag14
2022-11-11 11:09:48 -07:00

46 lines
1.2 KiB
C

#ifndef OSALLOC_H
#define OSALLOC_H
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSHeapDescriptor {
/* 0x0 */ s32 size;
/* 0x4 */ struct OSHeapCell* freeList;
/* 0x8 */ struct OSHeapCell* usedList;
} OSHeapDescriptor;
typedef struct OSHeapCell {
/* 0x00 */ struct OSHeapCell* prev;
/* 0x04 */ struct OSHeapCell* next;
/* 0x08 */ s32 size;
/* 0x0C */ struct OSHeapDescriptor* hd;
/* 0x10 */ s32 usedSize;
/* 0x14 */ char field_0x14[0x20 - 0x14];
} OSHeapCell;
typedef u32 OSHeapHandle;
extern volatile s32 __OSCurrHeap;
#define OSRoundUp(x, align) (((x) + (align)-1) & (-(align)))
#define OSRoundUpPtr(x, align) ((void*)((((u32)(x)) + (align)-1) & (~((align)-1))))
#define OSRoundDown(x, align) ((x) & (-(align)))
#define OSRoundDownPtr(x, align) ((void*)(((u32)(x)) & (~((align)-1))))
static OSHeapCell* DLInsert(OSHeapCell* list, OSHeapCell* child);
void OSFreeToHeap(OSHeapHandle handle, void* ptr);
s32 OSSetCurrentHeap(OSHeapHandle handle);
void* OSInitAlloc(void* lo, void* hi, s32 maxHeaps);
OSHeapHandle OSCreateHeap(void* start, void* end);
#ifdef __cplusplus
};
#endif
#endif /* OSALLOC_H */