mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Fix up using con_status* calls.
* Main was using CHECK_EFI_STATUS_OR_RETURN despite saying it shouldn't
* Use con_status* calls instead
* Clean up line-clobbering in con_status_{ok,fail}
This commit is contained in:
@@ -71,7 +71,7 @@ con_initialize (const CHAR16 *version)
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L" booting...\r\n");
|
||||
|
||||
con_status_begin(L"Setting console display mode: ");
|
||||
Print(L"%ux%u (%ux%u chars)\n",
|
||||
Print(L"%ux%u (%ux%u chars)",
|
||||
gfx_out_proto->Mode->Info->HorizontalResolution,
|
||||
gfx_out_proto->Mode->Info->VerticalResolution,
|
||||
ROWS, COLS);
|
||||
@@ -91,26 +91,30 @@ void
|
||||
con_status_ok ()
|
||||
{
|
||||
UINTN row = ST->ConOut->Mode->CursorRow;
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, COLS - 8, row - 1);
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, COLS-8, row);
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTGRAY);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L"[");
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_GREEN);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L" ok ");
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTGRAY);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L"]\r");
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, 0, row+1);
|
||||
}
|
||||
|
||||
void
|
||||
con_status_fail (const CHAR16 *error)
|
||||
{
|
||||
UINTN row = ST->ConOut->Mode->CursorRow;
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, COLS - 8, row - 1);
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, COLS-8, row);
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTGRAY);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L"[");
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTRED);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L"failed");
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTGRAY);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L"]\r\n");
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)L"]\r");
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, 2, row+1);
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_RED);
|
||||
ST->ConOut->OutputString(ST->ConOut, (CHAR16*)error);
|
||||
ST->ConOut->SetCursorPosition(ST->ConOut, 0, row+2);
|
||||
ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTGRAY);
|
||||
}
|
||||
@@ -25,11 +25,13 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
// From here on out, use CHECK_EFI_STATUS_OR_FAIL instead
|
||||
// because the console is now set up
|
||||
|
||||
/*
|
||||
Print(L" SystemTable: %x\n", SystemTable);
|
||||
if (SystemTable)
|
||||
Print(L" ConOut: %x\n", SystemTable->ConOut);
|
||||
if (SystemTable->ConOut)
|
||||
Print(L"OutputString: %x\n", SystemTable->ConOut->OutputString);
|
||||
*/
|
||||
|
||||
dump_memory_map();
|
||||
|
||||
@@ -39,15 +41,19 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
UINTN desc_size;
|
||||
UINT32 desc_version;
|
||||
|
||||
con_status_begin(L"Exiting boot services");
|
||||
memmap = LibMemoryMap(&memmap_size, &memmap_key,
|
||||
&desc_size, &desc_version);
|
||||
|
||||
status = ST->BootServices->ExitBootServices(ImageHandle, memmap_key);
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "Exiting boot services");
|
||||
CHECK_EFI_STATUS_OR_FAIL(status);
|
||||
con_status_ok();
|
||||
|
||||
con_status_begin(L"Setting virtual address map");
|
||||
status = ST->RuntimeServices->SetVirtualAddressMap(
|
||||
memmap_size, desc_size, desc_version, memmap);
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "Setting memory map");
|
||||
CHECK_EFI_STATUS_OR_FAIL(status);
|
||||
con_status_ok();
|
||||
|
||||
while (1) __asm__("hlt");
|
||||
return status;
|
||||
|
||||
@@ -10,10 +10,9 @@ const CHAR16 *util_error_message(EFI_STATUS status);
|
||||
return (s); \
|
||||
}
|
||||
|
||||
#define CHECK_EFI_STATUS_OR_FAIL(s, msg, ...) \
|
||||
#define CHECK_EFI_STATUS_OR_FAIL(s) \
|
||||
if (EFI_ERROR((s))) { \
|
||||
con_status_fail(util_error_message(s)); \
|
||||
Print(L"\n" msg, ## __VA_ARGS__ ); \
|
||||
while (1) __asm__("hlt"); \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user