commit b605554ea3fcf46fd5324908134d1c48f4a24a59
parent c41010422015c90adb51f7a39e4e33a152c89a4f
Author: Matsuda Kenji <info@mtkn.jp>
Date: Thu, 14 Mar 2024 15:41:17 +0900
stuck with compile error:
undefined reference to `___chkstk_ms'
Diffstat:
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/hello.c b/hello.c
@@ -6,17 +6,23 @@
EFI_STATUS
EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
+ EFI_STATUS stat;
+ CHAR16 s[19];
+
// Output firmware bender.
SystemTable->ConOut->OutputString(SystemTable->ConOut, SystemTable->FirmwareVendor);
// Output memory map information.
- UINTN mmsize = sizeof(EFI_MEMORY_DESCRIPTOR) * 32; // ?
- EFI_MEMORY_DESCRIPTOR mmap[32];
+ UINTN mmsize = sizeof(EFI_MEMORY_DESCRIPTOR) * 150; // ?
+ EFI_MEMORY_DESCRIPTOR mmap[150];
UINTN mkey;
UINTN dsize;
UINT32 dver;
- SystemTable->BootServices->GetMemoryMap(&mmsize, mmap, &mkey, &dsize, &dver);
+ stat = SystemTable->BootServices->GetMemoryMap(&mmsize, mmap, &mkey, &dsize, &dver);
+ if (stat != EFI_SUCCESS) {
+ return stat;
+ }
// Echo back user input.
EFI_INPUT_KEY Key;
diff --git a/uefi.h b/uefi.h
@@ -9,11 +9,16 @@ typedef unsigned long long UINTN;
typedef unsigned short UINT16;
typedef unsigned UINT32;
typedef unsigned long long UINT64;
-typedef unsigned long long EFI_STATUS;
+typedef UINTN EFI_STATUS;
typedef void *EFI_HANDLE;
typedef UINT64 EFI_PHYSICAL_ADDRESS;
typedef UINT64 EFI_VIRTUAL_ADDRESS;
+// EFI_STATUS
+enum {
+ EFI_SUCCESS = 0,
+};
+
typedef struct {
UINT16 ScanCode;
CHAR16 UnicodeChar;
@@ -43,7 +48,7 @@ typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
EFI_TEXT_STRING OutputString;
} EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
-typedef struct { // TODO implement.
+typedef struct {
UINT32 Type;
EFI_PHYSICAL_ADDRESS PhysicalStart;
EFI_VIRTUAL_ADDRESS VirtualStart;