SSBM Decomp
Loading...
Searching...
No Matches
OSAlloc.c File Reference
#include <platform.h>
#include <dolphin/os.h>
#include <dolphin/os/OSAlloc.h>

Macros

#define InRange(addr, start, end)    ((u8*) (start) <= (u8*) (addr) && (u8*) (addr) < (u8*) (end))
 
#define OFFSET(addr, align)   (((uintptr_t) (addr) & ((align) - 1)))
 
#define ALIGNMENT   32
 
#define MINOBJSIZE   64
 
#define CHECK(line, condition)
 

Functions

static void * DLAddFront (HeapCell *neighbor, HeapCell *cell)
 Inserts cell before neighbor and returns cell.
 
static HeapCellDLExtract (HeapCell *list, HeapCell *cell)
 Removes cell from list and returns list. *‍/.
 
static HeapCellDLInsert (HeapCell *list, HeapCell *cell, UNK_T _)
 
void * OSAllocFromHeap (OSHeapHandle heap, size_t size)
 
void OSFreeToHeap (OSHeapHandle heap, void *ptr)
 
OSHeapHandle OSSetCurrentHeap (OSHeapHandle heap)
 
void * OSInitAlloc (void *arenaStart, void *arenaEnd, int maxHeaps)
 
OSHeapHandle OSCreateHeap (void *start, void *end)
 
void OSDestroyHeap (size_t idx)
 
size_t OSCheckHeap (OSHeapHandle heap)
 

Variables

static HeapHeapArray
 
static ssize_t NumHeaps
 
static void * ArenaStart
 
static void * ArenaEnd
 
volatile OSHeapHandle __OSCurrHeap = -1
 
static char _unused_str0 [] = "\nOSDumpHeap(%d):\n"
 
static char _unused_str1 [] = "--------Inactive\n"
 
static char _unused_str2 [] = "addr\tsize\t\tend\tprev\tnext\n"
 
static char _unused_str3 [] = "--------Allocated\n"
 
static char _unused_str4 [] = "%x\t%d\t%x\t%x\t%x\n"
 
static char _unused_str5 [] = "--------Free\n"
 

Macro Definition Documentation

◆ InRange

#define InRange (   addr,
  start,
  end 
)     ((u8*) (start) <= (u8*) (addr) && (u8*) (addr) < (u8*) (end))

◆ OFFSET

#define OFFSET (   addr,
  align 
)    (((uintptr_t) (addr) & ((align) - 1)))

◆ ALIGNMENT

#define ALIGNMENT   32

◆ MINOBJSIZE

#define MINOBJSIZE   64

◆ CHECK

#define CHECK (   line,
  condition 
)
Value:
if (!(condition)) { \
OSReport("OSCheckHeap: Failed " #condition " in %d", line); \
return -1; \
}

Function Documentation

◆ DLAddFront()

static void * DLAddFront ( HeapCell neighbor,
HeapCell cell 
)
static

Inserts cell before neighbor and returns cell.

◆ DLExtract()

static HeapCell * DLExtract ( HeapCell list,
HeapCell cell 
)
static

Removes cell from list and returns list. *‍/.

◆ DLInsert()

static HeapCell * DLInsert ( HeapCell list,
HeapCell cell,
UNK_T  _ 
)
static
Parameters
list
cell
_Needed to match OSFreeToHeap.

◆ OSAllocFromHeap()

void * OSAllocFromHeap ( OSHeapHandle  heap,
size_t  size 
)

◆ OSFreeToHeap()

void OSFreeToHeap ( OSHeapHandle  heap,
void *  ptr 
)

◆ OSSetCurrentHeap()

OSHeapHandle OSSetCurrentHeap ( OSHeapHandle  heap)

◆ OSInitAlloc()

void * OSInitAlloc ( void *  arenaStart,
void *  arenaEnd,
int  maxHeaps 
)

◆ OSCreateHeap()

OSHeapHandle OSCreateHeap ( void *  start,
void *  end 
)

◆ OSDestroyHeap()

void OSDestroyHeap ( size_t  idx)

◆ OSCheckHeap()

size_t OSCheckHeap ( OSHeapHandle  heap)

Variable Documentation

◆ HeapArray

Heap* HeapArray
static

◆ NumHeaps

ssize_t NumHeaps
static

◆ ArenaStart

void* ArenaStart
static

◆ ArenaEnd

void* ArenaEnd
static

◆ __OSCurrHeap

volatile OSHeapHandle __OSCurrHeap = -1

◆ _unused_str0

char _unused_str0[] = "\nOSDumpHeap(%d):\n"
static

◆ _unused_str1

char _unused_str1[] = "--------Inactive\n"
static

◆ _unused_str2

char _unused_str2[] = "addr\tsize\t\tend\tprev\tnext\n"
static

◆ _unused_str3

char _unused_str3[] = "--------Allocated\n"
static

◆ _unused_str4

char _unused_str4[] = "%x\t%d\t%x\t%x\t%x\n"
static

◆ _unused_str5

char _unused_str5[] = "--------Free\n"
static