summaryrefslogtreecommitdiff
path: root/arm9/lib/include/OS_alloc.h
diff options
context:
space:
mode:
authorMartmists <mail@martmists.com>2020-05-01 19:44:04 +0200
committerGitHub <noreply@github.com>2020-05-01 19:44:04 +0200
commite370125c3e2e34936152768c40bd932b88690baa (patch)
tree85e8314866f65fb95e62a66b029ab5eeca55e994 /arm9/lib/include/OS_alloc.h
parent10b569f131fc58959d7c50dd4b07f01a52b5e162 (diff)
parentfa332326543d03fe6afdc0dcd04f0a666450955b (diff)
Merge pull request #51 from red031000/master
match OS_protectionRegion
Diffstat (limited to 'arm9/lib/include/OS_alloc.h')
-rw-r--r--arm9/lib/include/OS_alloc.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/arm9/lib/include/OS_alloc.h b/arm9/lib/include/OS_alloc.h
new file mode 100644
index 00000000..08fb3224
--- /dev/null
+++ b/arm9/lib/include/OS_alloc.h
@@ -0,0 +1,38 @@
+//
+// Created by mart on 4/23/20.
+//
+
+#ifndef POKEDIAMOND_OS_ALLOC_H
+#define POKEDIAMOND_OS_ALLOC_H
+
+#include "types.h"
+#include "OS_arena.h"
+
+typedef int OSHeapHandle;
+
+typedef struct Cell Cell;
+
+struct Cell {
+ Cell* prev;
+ Cell* next;
+ long size;
+};
+
+typedef struct {
+ long size;
+ Cell *free;
+ Cell *allocated;
+} HeapDesc;
+
+typedef struct {
+ volatile OSHeapHandle currentHeap;
+ int numHeaps;
+ void* arenaStart;
+ void* arenaEnd;
+ HeapDesc* heapArray;
+} OSHeapInfo;
+
+void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void *ptr);
+void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size);
+
+#endif //POKEDIAMOND_OS_ALLOC_H