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

Go to the source code of this file.

Functions

size_t __fast_phys_base_find_free_block__ (uint64_t *bitmap, size_t num_words)
 
static const char * pMemoryType (uint32_t type)
 
 INIT (phys_base_allocator)
 
void * phys_base_alloc (uint64_t block)
 
void * phys_base_alloc_on_top (uint64_t block)
 
uint64_t pys_base_get_free_block_count ()
 
void vxPhysBaseFree (void *ptr, uint64_t size)
 
void pmm_log_usage ()
 

Variables

uint64_t higher_base_length_ = 0
 
uint64_t usable_total = 0
 
uint64_t smallest_free_entry_base = (uint64_t) -1
 
size_t dma_bitmap_count = 0
 
uint8_tbitmap_base_ = 0
 
uint8_tdma_bitmap_base_ = 0
 
size_t dma_bitmap_size = 0
 
uint64_t metadata_count = 0
 
uint64_t metadata_size = 0
 
struct stivale2_struct_tag_memmapsaved_memmap_info = 0
 
static spinlock_t pmm_lock = {0}
 

Function Documentation

◆ __fast_phys_base_find_free_block__()

size_t __fast_phys_base_find_free_block__ ( uint64_t * bitmap,
size_t num_words )
extern

◆ INIT()

◆ phys_base_alloc()

◆ phys_base_alloc_on_top()

void * phys_base_alloc_on_top ( uint64_t block)

Definition at line 243 of file phys_base_allocator.c.

References NULL.

◆ pMemoryType()

◆ pmm_log_usage()

void pmm_log_usage ( )

◆ pys_base_get_free_block_count()

uint64_t pys_base_get_free_block_count ( )

Definition at line 250 of file phys_base_allocator.c.

References bitmap_base_, BLOCK_SIZE, count, and higher_base_length_.

Referenced by pmm_log_usage().

◆ vxPhysBaseFree()

void vxPhysBaseFree ( void * ptr,
uint64_t size )

Definition at line 263 of file phys_base_allocator.c.

References bitmap_base_, BLOCK_SIZE, pmm_lock, ptr, size, spin_acquire(), and spin_release().

Referenced by slab_cache_destroy().

Variable Documentation

◆ bitmap_base_

uint8_t* bitmap_base_ = 0

◆ dma_bitmap_base_

uint8_t* dma_bitmap_base_ = 0

Definition at line 19 of file phys_base_allocator.c.

◆ dma_bitmap_count

size_t dma_bitmap_count = 0

Definition at line 16 of file phys_base_allocator.c.

◆ dma_bitmap_size

size_t dma_bitmap_size = 0

Definition at line 20 of file phys_base_allocator.c.

◆ higher_base_length_

uint64_t higher_base_length_ = 0

Definition at line 13 of file phys_base_allocator.c.

Referenced by INIT(), phys_base_alloc(), and pys_base_get_free_block_count().

◆ metadata_count

uint64_t metadata_count = 0

Definition at line 21 of file phys_base_allocator.c.

Referenced by INIT().

◆ metadata_size

uint64_t metadata_size = 0

Definition at line 22 of file phys_base_allocator.c.

Referenced by INIT(), and INIT().

◆ pmm_lock

spinlock_t pmm_lock = {0}
static

Definition at line 185 of file phys_base_allocator.c.

Referenced by phys_base_alloc(), and vxPhysBaseFree().

◆ saved_memmap_info

struct stivale2_struct_tag_memmap* saved_memmap_info = 0

Definition at line 23 of file phys_base_allocator.c.

◆ smallest_free_entry_base

uint64_t smallest_free_entry_base = (uint64_t) -1

Definition at line 15 of file phys_base_allocator.c.

Referenced by INIT().

◆ usable_total

uint64_t usable_total = 0

Definition at line 14 of file phys_base_allocator.c.

Referenced by INIT(), and pmm_log_usage().