view boot/bootx64.c @ 11:09ced7d8f64a

improve boot source.
author taiki
date Tue, 22 Jan 2013 02:39:35 +0900
parents 6c0c504fddae
children ac5d699b9787
line wrap: on
line source

#include <efi.h>
#include <efilib.h>

#define LOCALFS_F2FD(f)		((UINTN)(f))
#define LOCALFS_FD2F(fd)	((EFI_FILE_HANDLE)(fd))

EFI_STATUS
efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table)
{
    InitializeLib(image, system_table);


    //EFI_FILE_HANDLE volume, fh;

    EFI_LOADED_IMAGE *info;
    CHAR16 *kname = L"kernel";
    Print(L"Boot start. %s , %d:\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);
	// status = uefi_call_wrapper(volume->Open, 5, volume, &fh, name, EFI_FILE_MODE_READ, (UINT64)0);

    if (status == EFI_SUCCESS) {
        Print(L"Opening kernel executable file is success.\n");
    } else {
        Print(L"Invalid open kernel executable file.\n");
    }

    while (1)
    {
        asm volatile ("cli" : : );
    }

    return EFI_SUCCESS;
}