|
Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
|
#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 |
|
static |
Definition at line 23 of file slab.c.
References addr, BLOCK_SIZE, freed_vaddr_count, freed_vaddrs, last_slab_addr, slab_global_lock, spin_acquire(), and spin_release().
Referenced by vxCreateSlabCache(), and vxSlabAlloc().
|
static |
Definition at line 36 of file slab.c.
References freed_vaddr_count, freed_vaddrs, MAX_FREED_VADDRS, slab_global_lock, spin_acquire(), and spin_release().
Referenced by slab_cache_destroy().
| void slab_cache_destroy | ( | struct slab_cache ** | cache | ) |
Definition at line 174 of file slab.c.
References cache, next, slab::next, NULL, paging_get_highest_page_map(), paging_unmap_page(), phys_addr, slab::phys_addr, push_freed_vaddr(), spin_acquire(), spin_release(), and vxPhysBaseFree().
| void slab_free | ( | struct slab_cache * | cache, |
| void * | obj ) |
Definition at line 235 of file slab.c.
References cache, slab::first_obj, slab::free_list, slab::free_objects, slab::next, NULL, prev, spin_acquire(), spin_release(), and slab::total_objects.
Referenced by __attribute__(), dentry_free_rcu(), free_netbuff(), and vma_tree_add_locked().
| void vxCreateSlabCache | ( | struct slab_cache ** | cache, |
| const char * | name, | ||
| const size_t | obj_size, | ||
| size_t | alignment, | ||
| const uintptr_t | virt_addr ) |
Definition at line 44 of file slab.c.
References ALIGN_UP, alignment, BLOCK_SIZE, cache, get_default_slab_addr(), LOG_INFO, memset(), name, obj_size, paging_get_highest_page_map(), phys_addr, phys_base_alloc(), strcpy(), and vxMmap().
Referenced by __attribute__(), INIT(), INIT(), INIT(), INIT(), INIT(), INIT(), INIT(), INIT(), INIT(), and vxSocket().
| void * vxSlabAlloc | ( | struct slab_cache * | cache | ) |
Definition at line 93 of file slab.c.
References actual_obj_size, BLOCK_SIZE, cache, slab::first_obj, slab::free_list, slab::free_objects, get_default_slab_addr(), LOG_ERROR, slab::magic, memset(), slab::next, NULL, paging_get_highest_page_map(), phys_addr, slab::phys_addr, phys_base_alloc(), spin_acquire(), spin_release(), slab::total_objects, and vxMmap().
Referenced by __attribute__(), create_netbuff(), create_netdev(), create_process(), create_vmm_page(), INIT(), INIT(), thrCreateInstance(), vma_register(), vma_tree_add_locked(), vxAllocScheduler(), and vxSocket().
|
static |
Definition at line 16 of file slab.c.
Referenced by get_default_slab_addr().
|
static |
Definition at line 18 of file slab.c.
Referenced by get_default_slab_addr(), and push_freed_vaddr().