LF OS
Hobby operating system for amd64 with high ambitions
|
Go to the source code of this file.
Functions | |
void | init_slab (ptr_t mem_start, ptr_t mem_end, size_t allocation_size) |
ptr_t | slab_alloc (SlabHeader *slab) |
void | slab_free (SlabHeader *slab, ptr_t mem) |
Initialize a new slab allocator at the given memory location. After initialization, you can use mem_start as pointer to SlabHeader for more operations.
mem_start | Memory address where the slab allocator region begins |
mem_end | Memory address where the slab allocator region ends |
allocation_size | Size of single objects in this allocator |
Definition at line 6 of file slab.c.
References bitmap_size(), header, and memset().
ptr_t slab_alloc | ( | SlabHeader * | slab | ) |
Allocate object from slab allocator region.
slab | mem_start given to init_slab before |
Definition at line 22 of file slab.c.
References bitmap_get(), bitmap_set(), SlabHeader::num_entries, panic_message(), and slab_mem().
void slab_free | ( | SlabHeader * | slab, |
ptr_t | memory | ||
) |
Free object in slab allocator region.
slab | mem_start given to init_slab before |
memory | Address to mark as free |
Definition at line 37 of file slab.c.
References bitmap_clear(), and slab_index().