Memory heap and allocator

This commit is contained in:
2026-02-26 20:24:56 +00:00
parent c2dd9d1e89
commit 770526efae
7 changed files with 603 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
#include <efi.h>
#include "commands.h"
#include "string_utils.h"
#include "memory.h"
#define SAFE_PRINT(Boot, ...) \
do { \
@@ -15,6 +16,7 @@ static void cmd_help(BootInfo *Boot, CHAR16 *Args);
static void cmd_man(BootInfo *Boot, CHAR16 *Args);
static void cmd_clear(BootInfo *Boot, CHAR16 *Args);
static void cmd_about(BootInfo *Boot, CHAR16 *Args);
static void cmd_mem(BootInfo *Boot, CHAR16 *Args);
// Command registry
static Command commands[] = {
@@ -48,6 +50,12 @@ static Command commands[] = {
L"Usage: about\n\r Shows information about this operating system.",
cmd_about
},
{
L"mem",
L"Display memory statistics",
L"Usage: mem\n\r Shows physical memory, heap, and paging information.",
cmd_mem
},
{NULL, NULL, NULL, NULL} // Sentinel
};
@@ -144,12 +152,19 @@ static void cmd_about(BootInfo *Boot, CHAR16 *Args)
SAFE_PRINT(Boot, L" - UEFI Boot\n\r");
SAFE_PRINT(Boot, L" - Console I/O\n\r");
SAFE_PRINT(Boot, L" - ELF64 Kernel Loader\n\r");
SAFE_PRINT(Boot, L" - Memory Management (PMM + Heap)\n\r");
SAFE_PRINT(Boot, L" - Interactive Command Interface\n\r");
SAFE_PRINT(Boot, L"\n\r");
SAFE_PRINT(Boot, L"Type 'help' for available commands.\n\r");
SAFE_PRINT(Boot, L"\n\r");
}
static void cmd_mem(BootInfo *Boot, CHAR16 *Args)
{
(void)Args;
memory_print_stats(Boot);
}
void show_help(BootInfo *Boot)
{
UINTN i = 0;