From 473112b1541cf81fa3670e0d1cb6de1c4a3281de Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 16 Jul 2024 23:55:32 +0200 Subject: kernel: make kmalloc accept a numeric "tag" instead of a freeform description This will both let me save space in the allocation header, and make the debugprint more readable. --- src/kernel/malloc.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/kernel/malloc.c') diff --git a/src/kernel/malloc.c b/src/kernel/malloc.c index 3c10108..ca44cfe 100644 --- a/src/kernel/malloc.c +++ b/src/kernel/malloc.c @@ -11,6 +11,27 @@ #define SCMIN 6 /* 1<<6 == 64 */ #define SCMAX 12 /* 1<<11 == 2048 */ +const char *tagnames[] = { + "TagInvalid", + "TagKernelFs", + "TagProcFs", + "TagUserFs", + "TagOpenPath", + "TagMountPath", + "TagMountUser", + "TagMountRoot", + "TagExecbuf", + "TagVfsReq", + "TagHandleset", + "TagHandle", + "TagProcess", + "TagProcessHandle", + "TagDevTime", + "TagRootCache", + "TagPageRefcount", +}; +static_assert(sizeof(tagnames) == sizeof(const char *) * TagLast); + typedef struct Slab Slab; struct Slab { /* The slab is divided up into 1<