#include <stdbool.h>#include <stddef.h>#include <string.h>#include "mm/kalloc.h"#include "kernel/limine_responses.h"#include "kernel/panic.h"#include "mm/frame.h"Data Structures | |
| struct | frame |
| Metadata for a physical frame. More... | |
Functions | |
| static bool | limine_entry_type_maybe_usable (uint64_t type) |
| Check if a Limine memmap entry type is either usable (now) or reclaimable. | |
| size_t | pfn_to_phys (size_t pfn) |
| Converts a PFN to a physical address. | |
| struct frame * | alloc_frame (const char *identifier) |
| Allocates a frame and returns a pointer to it. The allocated frame will be zeroed out. | |
| void | free_frame (struct frame *frame) |
| Frees a frame. | |
| size_t | frame_to_pfn (struct frame *frame) |
| Returns the PFN of a frame. | |
| static void | memmap_count_init (const struct limine_memmap_response *memmap_response) |
Counting the number of usable frames in the Limine memory map response to initialize memmap_count | |
| static void | find_memmap_base (const struct limine_memmap_response *memmap_response) |
Finds a suitable place in memory to place our own memmap, and initializes memmap, memmap_start_phys, and memmap_end_phys. | |
| void | memmap_init (const struct limine_memmap_response *memmap_response) |
Initializes the array of memmap entries and the free frame linked list based on the Limine memory map response. | |
| void | frame_init () |
| Initializes the frame allocator and memory map. | |
Variables | |
| static struct frame * | memmap |
| Array of physical frame metadata, indexed by PFN. | |
| static size_t | memmap_count |
| Number of frames in memmap. | |
| static size_t | memmap_start_phys = 0 |
| Physical address start of memmap, inclusive. Page aligned. | |
| static size_t | memmap_end_phys = 0 |
| Physical address end of memmap, exclusive. Page aligned. | |
| static struct frame * | free_frame_list |
| Pointer to the head of the free frame linked list. | |
| static const char *const | limine_memmap_entry_type_to_string [] |
| String representations of Limine memmap entry types for debugging purposes. | |
| struct frame * alloc_frame | ( | const char * | identifier | ) |
Allocates a frame and returns a pointer to it. The allocated frame will be zeroed out.
| identifier | A string identifier for the frame (for debugging purposes). |
|
static |
Finds a suitable place in memory to place our own memmap, and initializes memmap, memmap_start_phys, and memmap_end_phys.
| void frame_init | ( | ) |
Initializes the frame allocator and memory map.
Returns the PFN of a frame.
| frame | A pointer to the frame. |
| void free_frame | ( | struct frame * | frame | ) |
Frees a frame.
| frame | A pointer to the frame to free. |
Check if a Limine memmap entry type is either usable (now) or reclaimable.
| type | The Limine memmap entry type to check. |
|
static |
Counting the number of usable frames in the Limine memory map response to initialize memmap_count
| void memmap_init | ( | const struct limine_memmap_response * | memmap_response | ) |
Initializes the array of memmap entries and the free frame linked list based on the Limine memory map response.
Converts a PFN to a physical address.
| pfn | The PFN to convert. |
|
static |
Pointer to the head of the free frame linked list.
|
static |
String representations of Limine memmap entry types for debugging purposes.
|
static |
Array of physical frame metadata, indexed by PFN.
|
static |
Number of frames in memmap.
|
static |
Physical address end of memmap, exclusive. Page aligned.
|
static |
Physical address start of memmap, inclusive. Page aligned.