diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-03-11 21:30:31 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-03-11 21:30:31 -0400 |
commit | d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d (patch) | |
tree | 8f0b5cd8aad31089131785dc6e37b659490f9955 /mem/slab.h | |
download | jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.tar.gz jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.tar.bz2 jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.zip |
usermode capable kernel with logging syscall
Diffstat (limited to 'mem/slab.h')
-rw-r--r-- | mem/slab.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mem/slab.h b/mem/slab.h new file mode 100644 index 0000000..074d278 --- /dev/null +++ b/mem/slab.h @@ -0,0 +1,33 @@ +#ifndef JOVE_MEMORY_SLAB_H +#define JOVE_MEMORY_SLAB_H 1 + +#include <stdint.h> +#include <stddef.h> +#include <stdbool.h> + +#define SLABCACHE_NAME_LIMIT 32 +struct SlabCache +{ + char name[SLABCACHE_NAME_LIMIT]; + + struct SlabDescriptor *list_free; + struct SlabDescriptor *list_partial; + struct SlabDescriptor *list_full; + + size_t obj_size; + size_t slab_pages; +}; + +struct SlabDescriptor +{ + struct SlabDescriptor *prev; + struct SlabDescriptor *next; + void *slab_base; + void *obj_base; + + size_t free_count; + int free_index; + uintptr_t free[]; +}; + +#endif |