Mercurial > hg > Members > taiki > EFIKernel
view boot/bootx64.c @ 19:2fbe46f63d4c
separate source file.
author | taiki |
---|---|
date | Fri, 08 Feb 2013 19:12:05 +0900 |
parents | bd4c99e700e8 |
children | 5e184d4c01b8 |
line wrap: on
line source
/* * This program is EFI boot loader. * load Mach-O kernel, and locate on memory, and jump kernel. * * Author: Taiki TAIRA. */ #include "bootx64.h" #include "mach-o/mach_o.h" static inline void start_kernel() { } /* start cbc kernel boot loader. */ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table) { InitializeLib(image, system_table); EFI_LOADED_IMAGE *info; CHAR16 *kname = L"kernel"; Print(L"Boot start. %s\n", kname); uefi_call_wrapper(BS->SetWatchdogTimer, 4, 0, 0x0, 0, NULL); Print(L"Set watchdog timer.\n"); EFI_STATUS status = uefi_call_wrapper(BS->HandleProtocol, 3, image, &LoadedImageProtocol, (VOID **) &info); if (EFI_ERROR(status)) { Print(L"Load error.\n"); return EFI_LOAD_ERROR; } fs_t fs; dev_tab_t boot_dev; status = config_fs(info->DeviceHandle, &fs, &boot_dev); EFI_FILE_HANDLE fd; open(&fs, &fd, kname); load(&fs, &fd, kname); close(&fs, &fd); UINTN cookie = 0; uefi_call_wrapper(BS->ExitBootServices, 2, image, cookie); start_kernel(); status = EFI_SUCCESS; return status; }