setos

拙OS
Log | Files | Refs

commit e3e9af2641fa665696ab4c619da8bde622940749
parent 2e9c53fab2e2c0d0a28b608921af7993449d8aeb
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sat, 16 Mar 2024 16:01:51 +0900

use printf

Diffstat:
Mhello.c | 6++----
Mutils.c | 11+++++++++--
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/hello.c b/hello.c @@ -15,7 +15,7 @@ EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *systab) // Output firmware bender. SystemTable->ConOut->ClearScreen(SystemTable->ConOut); SystemTable->ConOut->OutputString(SystemTable->ConOut, SystemTable->FirmwareVendor); - printf("--%s--%d--\n\r", "char *", 1259320); + printf("--%s--%d--\n==\n", "char *", 1259320); // Output memory map information. UINTN mmsize = 8196; @@ -36,9 +36,7 @@ EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *systab) if (mmap->Type != EfiConventionalMemory) { continue; } - SystemTable->ConOut->OutputString(SystemTable->ConOut, sprinth(mmap->Type, s)); - s[0] = '\t'; s[1] = '\0'; - SystemTable->ConOut->OutputString(SystemTable->ConOut, s); + printf("%d\t", mmap->Type); SystemTable->ConOut->OutputString(SystemTable->ConOut, sprinth(mmap->VirtualStart, s)); s[0] = '\t'; s[1] = '\0'; SystemTable->ConOut->OutputString(SystemTable->ConOut, s); diff --git a/utils.c b/utils.c @@ -34,8 +34,15 @@ printf(char *fmt, ...) va_start(ap, fmt); for (;*fmt;) { if (*fmt != '%') { - *buf++ = (CHAR16) *fmt++; - continue; + if (*fmt == '\n') { + *buf++ = (CHAR16) '\n'; + *buf++ = (CHAR16) '\r'; + fmt++; + continue; + } else { + *buf++ = (CHAR16) *fmt++; + continue; + } } fmt++; switch (*fmt++) {