PatchworkOS
Loading...
Searching...
No Matches
mem.c File Reference
#include "mem.h"
#include "efidef.h"
#include <efilib.h>
#include <kernel/defs.h>
#include <kernel/mem/paging_types.h>
#include <boot/boot_info.h>
#include <kernel/mem/paging.h>
#include <sys/proc.h>

Go to the source code of this file.

Functions

EFI_STATUS mem_init (void)
 Initializes the basic memory allocator.
 
EFI_STATUS mem_map_init (boot_memory_map_t *map)
 Initialize and load the memory map provided by the UEFI firmware.
 
void mem_map_deinit (boot_memory_map_t *map)
 Deinitializes the memory map and frees any allocated resources.
 
static NORETURN void panic_without_boot_services (uint8_t red, uint8_t green, uint8_t blue)
 
static uint64_t basic_allocator_alloc_pages (void **pages, uint64_t amount)
 
void mem_page_table_init (page_table_t *table, boot_memory_map_t *map, boot_gop_t *gop, boot_kernel_t *kernel)
 Initializes a page table for use by the kernel.
 

Variables

struct { 
 
   EFI_PHYSICAL_ADDRESS   buffer 
 
   uint64_t   maxPages 
 
   uint64_t   pagesAllocated 
 
   boot_gop_t *   gop 
 
   boot_memory_map_t *   map 
 
basicAllocator 
 

Function Documentation

◆ basic_allocator_alloc_pages()

static uint64_t basic_allocator_alloc_pages ( void **  pages,
uint64_t  amount 
)
static

Definition at line 109 of file mem.c.

References basicAllocator, PAGE_SIZE, and panic_without_boot_services().

Referenced by mem_page_table_init().

◆ panic_without_boot_services()

static NORETURN void panic_without_boot_services ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
static

Definition at line 90 of file mem.c.

References basicAllocator, x, and y.

Referenced by basic_allocator_alloc_pages(), and mem_page_table_init().

Variable Documentation

◆ [struct]

◆ buffer

EFI_PHYSICAL_ADDRESS buffer

Definition at line 15 of file mem.c.

Referenced by _file_init(), _std_stream_init(), _syscall_getdents(), _syscall_read(), _syscall_write(), acpi_table_read(), aml_buffer_set(), aml_buffer_to_buffer_field(), aml_buffer_to_debug_object(), aml_buffer_to_integer(), aml_buffer_to_string(), aml_convert_to_decimal_string(), aml_convert_to_hex_string(), aml_name_string_to_string(), aml_object_map_key(), aml_object_to_string(), bitmap_init(), cmdline_read(), const_null_read(), const_null_write(), const_one_read(), const_zero_read(), ctl_dispatch(), dentry_cache_key(), dentry_generic_getdents(), fb_info_read(), getdents(), gop_buffer_init(), interactive_shell(), join_args(), kbd_events_read(), kbd_name_read(), local_socket_recv(), local_socket_send(), map_key_buffer(), mount_cache_key(), mouse_events_read(), mouse_name_read(), note_queue_write(), page_table_page_buffer_flush(), page_table_page_buffer_push(), pipe_read(), pipe_write(), pipeline_execute(), pmm_bitmap_init(), print_stat(), procedure(), process_cmdline_read(), process_cwd_read(), process_note_write(), process_prio_read(), process_prio_write(), process_wait_read(), ramfs_inode_new(), ramfs_read(), ramfs_write(), rand_gen(), rand_gen_fallback(), read(), read_fd(), readfile(), ring_init(), ring_read(), ring_read_at(), ring_write(), socket_factory_read(), space_pin(), space_populate_user_region(), stack_overflow(), stack_pointer_init_buffer(), startmenu_procedure(), statistics_cpu_read(), statistics_mem_read(), SYSCALL_DEFINE(), SYSCALL_DEFINE(), SYSCALL_DEFINE(), SYSCALL_DEFINE(), taskbar_update_clock(), terminal_columns_get(), terminal_handle_output(), thread_send_note(), vfs_getdents(), vfs_read(), vfs_stat(), vfs_write(), vreadf(), vwritef(), write(), and writefile().

◆ gop

◆ map

◆ maxPages

uint64_t maxPages

Definition at line 16 of file mem.c.

Referenced by stack_pointer_init(), and thread_id_to_offset().

◆ pagesAllocated

uint64_t pagesAllocated

Definition at line 17 of file mem.c.