efi: clear screen before boot (#16)

This commit is contained in:
a1ive 2025-04-14 17:12:06 +09:00 committed by A1ive
parent eb8420b6d6
commit aa023a283b
4 changed files with 45 additions and 0 deletions

View File

@ -81,4 +81,6 @@ extern void efi_free (void *ptr);
extern void efi_free_pages (void *ptr, UINTN pages);
extern void *efi_allocate_pages (UINTN pages, EFI_MEMORY_TYPE type);
extern void efi_cls (void);
#endif /* _EFI_H */

View File

@ -7,6 +7,7 @@ OBJECTS += kern/efiblock.o
OBJECTS += kern/efiboot.o
OBJECTS += kern/efifile.o
OBJECTS += kern/efimain.o
OBJECTS += kern/efiterm.o
OBJECTS += kern/payload.o
OBJECTS += kern/callback.o

View File

@ -161,6 +161,8 @@ void efi_boot (EFI_DEVICE_PATH_PROTOCOL *path,
efi_open_protocol_wrapper;
#endif
efi_cls ();
/* Start image */
if ((efirc = bs->StartImage (handle, NULL, NULL)) != 0)
{

40
kern/efiterm.c Normal file
View File

@ -0,0 +1,40 @@
/*
* ntloader -- Microsoft Windows NT6+ loader
* Copyright (C) 2025 A1ive.
*
* ntloader is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* ntloader is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ntloader. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <strings.h>
#include <wchar.h>
#include "vdisk.h"
#include "cpio.h"
#include "ntloader.h"
#include "bcd.h"
#include "cmdline.h"
#include "efi.h"
void efi_cls (void)
{
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *conout = efi_systab->ConOut;
INT32 orig_attr = conout->Mode->Attribute;
conout->SetAttribute (conout, EFI_BLACK);
conout->ClearScreen (conout);
conout->SetAttribute (conout, orig_attr);
}