aboutsummaryrefslogtreecommitdiff
path: root/include/base/memory.h
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-12-05 15:17:44 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-12-05 15:17:44 -0800
commitb48327d357e0818d1a6ae2a064cfa7d1567e1242 (patch)
tree4677f228a9846937a7ec71c72a1ab63ab69d68ab /include/base/memory.h
parentc200dd832789afa298ba45e0b9efdec96c0e92cc (diff)
feat(huge): huge refactor (in progress).
Commented out libc includes to uncover all explicit dependencies. A large fraction has now been ported over (no testing). I did not port over the command line tools, such as the rc shell. These will be done independently - as of now I just want the library to stand independent. Compilation currently fails due to the lack of math functions.
Diffstat (limited to 'include/base/memory.h')
-rw-r--r--include/base/memory.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/base/memory.h b/include/base/memory.h
index 767e948..6bf3cbc 100644
--- a/include/base/memory.h
+++ b/include/base/memory.h
@@ -8,6 +8,7 @@ int mem·move(void *dst, uintptr size, void *src);
int mem·copy(void *dst, uintptr size, void *src);
int mem·compare(void *, uintptr size, void *);
void *mem·findc(void *dst, uintptr len, int c);
+void *mem·rfindc(void *dst, uintptr len, int c);
int mem·set(void *dst, uintptr size, int val);
int mem·set64(void *dst, uintptr size, uint64 val);
@@ -49,23 +50,25 @@ typedef struct mem·Pool mem·Pool;
typedef struct mem·Arena mem·Arena;
typedef struct mem·Allocator {
- void *(*alloc)(void *heap, uint n, ulong size);
- void *(*realloc)(void *iface, void *ptr, uint n, ulong size);
+ void *(*alloc)(void *heap, long n, uintptr size);
+ void *(*realloc)(void *heap, void *ptr, long n, uintptr size);
void (*free)(void *heap, void *ptr);
} mem·Allocator;
-extern mem·Allocator base·Memory; /* standard allocator */
+/* standard allocator */
+extern mem·Allocator base·Memory;
/* pool allocator (manages free list) */
-mem·Pool *mem·makepool(mem·Allocator from, void*);
-void mem·freepool(mem·Pool);
+mem·Pool *mem·makepool(mem·Allocator from, void*, char *name, int flags, intptr maxsize, intptr mincore);
+void mem·freepool(mem·Pool *);
-void *mem·poolalloc(mem·Pool *, uintptr n, uintptr size);
-void *mem·poolrealloc(mem·Pool *, void *, uintptr n, uintptr size);
+void *mem·poolalloc(mem·Pool *, long n, uintptr size);
+void *mem·poolrealloc(mem·Pool *, void *, long n, uintptr size);
void mem·poolfree(mem·Pool *, void *);
/* simple arena allocator (heterogeneous bump) */
mem·Arena *mem·makearena(mem·Allocator from, void*);
-void *mem·arenaalloc(mem·Arena *A, uint n, ulong size);
+void *mem·arenaalloc(mem·Arena *A, long n, ulong size);
void mem·freearena(mem·Arena *A);
+
extern mem·Allocator mem·ArenaAllocator;