|
Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
|
#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_t * | bitmap_base_ = 0 |
| uint8_t * | dma_bitmap_base_ = 0 |
| size_t | dma_bitmap_size = 0 |
| uint64_t | metadata_count = 0 |
| uint64_t | metadata_size = 0 |
| struct stivale2_struct_tag_memmap * | saved_memmap_info = 0 |
| static spinlock_t | pmm_lock = {0} |
| INIT | ( | phys_base_allocator | ) |
Definition at line 53 of file phys_base_allocator.c.
References ALIGN_UP, bitmap_base_, BLOCK_SIZE, ENTRY_MMAP_USABLE, higher_base_length_, LOG_ERROR, LOG_INFO, memset(), metadata_count, metadata_size, NULL, pMemoryType(), smallest_free_entry_base, STIVALE2_MMAP_RESERVED, STIVALE2_MMAP_USABLE, and usable_total.
| void * phys_base_alloc | ( | uint64_t | block | ) |
Definition at line 187 of file phys_base_allocator.c.
References bitmap_base_, BLOCK_SIZE, higher_base_length_, memcopy(), NULL, pmm_lock, spin_acquire(), spin_release(), and used.
Referenced by __attribute__(), alloc_page_locked(), elf_load(), elf_mmap_got(), execve(), INIT(), mmap_handle_anonymous(), paging_create_page_directory(), syscall_brk(), vxCreateSlabCache(), vxMmap(), and vxSlabAlloc().
| void * phys_base_alloc_on_top | ( | uint64_t | block | ) |
Definition at line 243 of file phys_base_allocator.c.
References NULL.
|
static |
Definition at line 28 of file phys_base_allocator.c.
References ENTRY_MMAP_ACPI_NVS, ENTRY_MMAP_ACPI_RECLAIMABLE, ENTRY_MMAP_BAD_MEMORY, ENTRY_MMAP_BOOTLOADER_RECLAIMABLE, ENTRY_MMAP_FRAMEBUFFER, ENTRY_MMAP_KERNEL_AND_MODULES, ENTRY_MMAP_RESERVED, ENTRY_MMAP_USABLE, and type.
Referenced by INIT().
| void pmm_log_usage | ( | ) |
Definition at line 272 of file phys_base_allocator.c.
References BLOCK_SIZE, DEBUG_LEVEL_INFO, KDEBUG, pys_base_get_free_block_count(), and usable_total.
Referenced by __attribute__().
| 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().
| 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().
| uint8_t* bitmap_base_ = 0 |
Definition at line 18 of file phys_base_allocator.c.
Referenced by INIT(), INIT(), phys_base_alloc(), pys_base_get_free_block_count(), and vxPhysBaseFree().
| uint8_t* dma_bitmap_base_ = 0 |
Definition at line 19 of file phys_base_allocator.c.
| size_t dma_bitmap_count = 0 |
Definition at line 16 of file phys_base_allocator.c.
| size_t dma_bitmap_size = 0 |
Definition at line 20 of file phys_base_allocator.c.
| 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().
| uint64_t metadata_count = 0 |
Definition at line 21 of file phys_base_allocator.c.
Referenced by INIT().
| uint64_t metadata_size = 0 |
Definition at line 22 of file phys_base_allocator.c.
|
static |
Definition at line 185 of file phys_base_allocator.c.
Referenced by phys_base_alloc(), and vxPhysBaseFree().
| struct stivale2_struct_tag_memmap* saved_memmap_info = 0 |
Definition at line 23 of file phys_base_allocator.c.
Definition at line 15 of file phys_base_allocator.c.
Referenced by INIT().
| uint64_t usable_total = 0 |
Definition at line 14 of file phys_base_allocator.c.
Referenced by INIT(), and pmm_log_usage().