Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
slab.c File Reference
#include "slab.h"
#include <type.h>
#include <libk/serial.h>
#include <str.h>
#include <hal/cpu/paging.h>
#include <spinlock.h>
#include <memory/phys_base_allocator.h>
#include <memory/memory_utils.h>

Go to the source code of this file.

Macros

#define MAX_FREED_VADDRS   512
 
#define DEFAULT_SLAB_ADDR   0xFFFFFF8080000000
 

Functions

static uintptr_t get_default_slab_addr ()
 
static void push_freed_vaddr (uintptr_t vaddr)
 
void vxCreateSlabCache (struct slab_cache **cache, const char *name, const size_t obj_size, size_t alignment, const uintptr_t virt_addr)
 
void * vxSlabAlloc (struct slab_cache *cache)
 
void slab_cache_destroy (struct slab_cache **cache)
 
void slab_free (struct slab_cache *cache, void *obj)
 

Variables

static uintptr_t last_slab_addr = 0xFFFFFF8080000000
 
static spinlock_t slab_global_lock = {0}
 
static uintptr_t freed_vaddrs [512] = {0}
 
static size_t freed_vaddr_count = 0
 

Macro Definition Documentation

◆ DEFAULT_SLAB_ADDR

#define DEFAULT_SLAB_ADDR   0xFFFFFF8080000000

Definition at line 15 of file slab.c.

◆ MAX_FREED_VADDRS

#define MAX_FREED_VADDRS   512

Definition at line 13 of file slab.c.

Function Documentation

◆ get_default_slab_addr()

static uintptr_t get_default_slab_addr ( )
static

◆ push_freed_vaddr()

static void push_freed_vaddr ( uintptr_t vaddr)
static

◆ slab_cache_destroy()

◆ 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

◆ freed_vaddr_count

size_t freed_vaddr_count = 0
static

Definition at line 21 of file slab.c.

◆ freed_vaddrs

uintptr_t freed_vaddrs[512] = {0}
static

Definition at line 20 of file slab.c.

◆ last_slab_addr

uintptr_t last_slab_addr = 0xFFFFFF8080000000
static

Definition at line 16 of file slab.c.

Referenced by get_default_slab_addr().

◆ slab_global_lock

spinlock_t slab_global_lock = {0}
static

Definition at line 18 of file slab.c.

Referenced by get_default_slab_addr(), and push_freed_vaddr().