Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
slab.h File Reference
#include <type.h>
#include <spinlock.h>

Go to the source code of this file.

Data Structures

struct  slab
 
struct  slab_cache
 

Functions

struct slab __attribute__ ((aligned(64)))
 
void vxCreateSlabCache (struct slab_cache **cache, const char *name, const size_t obj_size, size_t alignment, const uintptr_t virt_addr)
 
void slab_cache_destroy (struct slab_cache **cache)
 
void * vxSlabAlloc (struct slab_cache *cache)
 
void slab_free (struct slab_cache *cache, void *obj)
 
void slab_cache_stats (struct slab_cache *cache, size_t *total_objs, size_t *used_objs, size_t *free_objs)
 

Variables

uint32_t magic
 
struct slabnext
 
void * first_obj
 
void * free_list
 
size_t total_objects
 
size_t free_objects
 
uintptr_t phys_addr
 
spinlock_t lock
 
char name [32]
 
size_t obj_size
 
size_t actual_obj_size
 
size_t alignment
 
size_t slab_size
 
struct slabslabs_full
 
struct slabslabs_partial
 
struct slabslabs_free
 
size_t total_slabs
 
uintptr_t current_virt_addr
 
boolean_t default_virt_addr
 

Function Documentation

◆ __attribute__()

struct slab __attribute__ ( (aligned(64)) )

Definition at line 1 of file core.h.

◆ slab_cache_destroy()

◆ slab_cache_stats()

void slab_cache_stats ( struct slab_cache * cache,
size_t * total_objs,
size_t * used_objs,
size_t * free_objs )

References cache.

◆ slab_free()

void slab_free ( struct slab_cache * cache,
void * obj )

◆ vxCreateSlabCache()

void vxCreateSlabCache ( struct slab_cache ** cache,
const char * name,
const size_t obj_size,
size_t alignment,
const uintptr_t virt_addr )

◆ vxSlabAlloc()

Variable Documentation

◆ actual_obj_size

size_t actual_obj_size

Definition at line 3 of file slab.h.

Referenced by vxSlabAlloc().

◆ alignment

size_t alignment

Definition at line 4 of file slab.h.

Referenced by vxCreateSlabCache().

◆ current_virt_addr

uintptr_t current_virt_addr

Definition at line 17 of file slab.h.

◆ default_virt_addr

boolean_t default_virt_addr

Definition at line 18 of file slab.h.

◆ first_obj

void* first_obj

Definition at line 2 of file slab.h.

◆ free_list

void* free_list

Definition at line 3 of file slab.h.

◆ free_objects

size_t free_objects

Definition at line 5 of file slab.h.

◆ lock

spinlock_t lock

Definition at line 0 of file slab.h.

◆ magic

uint32_t magic

Definition at line 0 of file slab.h.

◆ name

char name[32]

Definition at line 1 of file slab.h.

◆ next

struct slab* next

Definition at line 1 of file slab.h.

◆ obj_size

size_t obj_size

Definition at line 2 of file slab.h.

Referenced by vxCreateSlabCache().

◆ phys_addr

◆ slab_size

size_t slab_size

Definition at line 5 of file slab.h.

◆ slabs_free

struct slab* slabs_free

Definition at line 9 of file slab.h.

◆ slabs_full

struct slab* slabs_full

Definition at line 7 of file slab.h.

◆ slabs_partial

struct slab* slabs_partial

Definition at line 8 of file slab.h.

◆ total_objects

size_t total_objects

Definition at line 4 of file slab.h.

◆ total_slabs

size_t total_slabs

Definition at line 11 of file slab.h.