Refactor boot_info.h and related files for improved abstraction and consistency. Updated function signatures to use generic types, replaced UEFI-specific types with kernel types, and enhanced documentation for clarity. Adjusted kernel entry point and service wrappers to align with new structure.

This commit is contained in:
2026-02-27 19:53:40 +00:00
parent 13a281fa4f
commit a3edb854f4
10 changed files with 181 additions and 103 deletions

View File

@@ -11,7 +11,7 @@
* 3. Append an entry to commands[] (before the sentinel)
*/
#include <efi.h>
#include "kernel_types.h"
#include "commands.h"
#include "string_utils.h"
#include "memory.h"
@@ -112,10 +112,6 @@ static Command commands[] = {
* System control
* ================================================================ */
/*
* Try Boot->shutdown first, then fall back to RuntimeServices, then
* print an error if neither is available.
*/
static void request_shutdown(BootInfo *Boot)
{
if (Boot == NULL) {
@@ -127,14 +123,6 @@ static void request_shutdown(BootInfo *Boot)
return;
}
if (Boot->SystemTable != NULL &&
Boot->SystemTable->RuntimeServices != NULL &&
Boot->SystemTable->RuntimeServices->ResetSystem != NULL) {
Boot->SystemTable->RuntimeServices->ResetSystem(
EfiResetShutdown, EFI_SUCCESS, 0, NULL);
return;
}
SAFE_PRINT(Boot, L"Shutdown service unavailable.\n\r");
}
@@ -185,13 +173,14 @@ static void cmd_man(BootInfo *Boot, CHAR16 *Args)
static void cmd_clear(BootInfo *Boot, CHAR16 *Args)
{
EFI_STATUS Status;
KSTATUS Status;
(void)Args;
if (Boot != NULL && Boot->clear_screen != NULL) {
Status = Boot->clear_screen();
if (EFI_ERROR(Status)) {
SAFE_PRINT(Boot, L"Failed to clear screen: %r\n\r", Status);
if (Status != 0) {
SAFE_PRINT(Boot, L"Failed to clear screen (status=%ld)\n\r",
(UINT64)Status);
}
} else {
SAFE_PRINT(Boot, L"Clear screen function unavailable.\n\r");