Mercurial > hg > Gears > UEFIloader
changeset 7:f422d46482db
run into the kernel but it crashed
author | kono |
---|---|
date | Fri, 19 Jan 2024 15:48:18 +0900 |
parents | 117ef669f2ce |
children | c4198b641a84 |
files | gnu-efi-3.0.12/apps/bootloader.c |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gnu-efi-3.0.12/apps/bootloader.c Fri Jan 19 11:25:58 2024 +0900 +++ b/gnu-efi-3.0.12/apps/bootloader.c Fri Jan 19 15:48:18 2024 +0900 @@ -22,6 +22,16 @@ UINT32 DescriptorVersion; }; +void HexDump(UINT8 *bytePtr, UINTN size) { + for (UINTN i = 0; i < size; i++) { + if (i % 16 == 0 && i != 0) { + Print(L"\n"); + } + Print(L"%02x ", bytePtr[i]); + } + Print(L"\n"); +} + EFI_STATUS LoadFile(CHAR16 *FileName, EFI_PHYSICAL_ADDRESS *FileAddr, UINTN *FilePageSize) { EFI_STATUS Status; @@ -119,8 +129,9 @@ Print(L"Boot 1\n"); struct BootParam boot_param; - boot_param.kernel_addr = KernelBaseAddr; - boot_param.kernel_entry = KernelBaseAddr; + KernelBaseAddr = (EFI_PHYSICAL_ADDRESS ) ((UINT64)KernelBaseAddr + 0x1000); + boot_param.kernel_addr = KernelBaseAddr ; + boot_param.kernel_entry = boot_param.kernel_addr ; // GetGraphicMode(ImageHandle, &(boot_param.graphic_config)); typedef unsigned long (EntryPoint)(struct BootParam*); @@ -149,13 +160,18 @@ } Print(L"Boot 3\n"); + Print(L"Kernel Entry: %llx\n",boot_param.kernel_entry); + Print(L"RSDP Address: %llx\n",boot_param.rsdp_addr); + Print(L"Kernel Address: %llx\n",boot_param.kernel_addr); + + HexDump((UINT8 *)KernelBaseAddr,0x100); + Status = uefi_call_wrapper(SystemTable->BootServices->ExitBootServices, 2, ImageHandle, MemoryMap.MapKey); if (EFI_ERROR(Status)) { Print(L"Failed to exit boot services\n"); return Status; } - Print(L"Start Entry\n"); Entry(&boot_param); return Status;