diff options
Diffstat (limited to 'src/kernel/malloc.h')
-rw-r--r-- | src/kernel/malloc.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/kernel/malloc.h b/src/kernel/malloc.h index bda2745..a38d49b 100644 --- a/src/kernel/malloc.h +++ b/src/kernel/malloc.h @@ -10,6 +10,28 @@ * dead code. */ #define KMALLOC_MAX 1024 +/* also see the string table in malloc.c */ +enum MallocTag { + TagInvalid, + TagKernelFs, + TagProcFs, + TagUserFs, + TagOpenPath, + TagMountPath, + TagMountUser, + TagMountRoot, + TagExecbuf, + TagVfsReq, + TagHandleset, + TagHandle, + TagProcess, + TagProcessHandle, + TagDevTime, + TagRootCache, + TagPageRefcount, + TagLast, +}; + void mem_init(void *memtop); void mem_reserve(void *addr, size_t len); void mem_debugprint(void); @@ -24,12 +46,12 @@ void *page_zalloc(size_t pages); // frees `pages` consecutive pages starting from *first void page_free(void *first, size_t pages); -void *kmalloc(size_t len, const char *desc); +void *kmalloc(size_t len, enum MallocTag tag); void kfree(void *ptr); // TODO calloc -static inline void *kzalloc(size_t len, const char *desc) { - void *b = kmalloc(len, desc); +static inline void *kzalloc(size_t len, enum MallocTag tag) { + void *b = kmalloc(len, tag); memset(b, 0, len); return b; } |