changeset 16:2013da6b3211

start to write reading part.
author taiki
date Fri, 01 Feb 2013 06:16:32 +0900
parents ac5d699b9787
children 30fd7afa7222
files boot/bootx64.c boot/bootx64.efi
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/boot/bootx64.c	Tue Jan 29 14:45:00 2013 +0900
+++ b/boot/bootx64.c	Fri Feb 01 06:16:32 2013 +0900
@@ -107,6 +107,8 @@
         return status;
     }
 
+    /* alloc */
+
     SetMem(proto, sizeof(EFI_HANDLE), 0);
 
     uefi_call_wrapper(BS->LocateHandle, 5, ByProtocol, &proto, NULL, &size, NULL);
@@ -133,6 +135,12 @@
     return EFI_SUCCESS;
 }
 
+
+static inline void
+start_kernel()
+{
+}
+
 /* start cbc kernel boot loader. */
 
 EFI_STATUS
@@ -148,7 +156,8 @@
     Print(L"Set watchdog timer.\n");
 
     EFI_STATUS status = uefi_call_wrapper(BS->HandleProtocol, 3, image, &LoadedImageProtocol, (VOID **) &info);
-    if (efi_error(L"Load error.\n", status)) {
+    if (EFI_ERROR(status)) {
+        Print(L"Load error.\n");
         return EFI_LOAD_ERROR;
     }
 
@@ -159,6 +168,13 @@
     UINTN fd;
     open(kname, &fd, &fs);
 
+    load_mach_o();
+
+    UINTN cookie = 0;
+    uefi_call_wrapper(BS->ExitBootServices, 2, image, cookie);
+
+    start_kernel();
+
     status = EFI_SUCCESS;
     return status;
 }
Binary file boot/bootx64.efi has changed