0
|
1 #include <efi.h>
|
|
2 #include <efilib.h>
|
|
3
|
1
|
4 #include "registers.h"
|
|
5
|
0
|
6 EFI_STATUS
|
|
7 efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
|
8 {
|
8
|
9 EFI_LOADED_IMAGE *loadedImage;
|
|
10
|
0
|
11 InitializeLib(image, systab);
|
|
12
|
8
|
13 uefi_call_wrapper(systab->ConOut->Reset, 2, systab->ConOut, FALSE);
|
|
14
|
|
15 Print(L"---- start ----\n");
|
|
16
|
|
17 EFI_STATUS status;
|
|
18
|
|
19 Print(L"Open Protocol\n");
|
|
20 status = uefi_call_wrapper(
|
|
21 BS->OpenProtocol,
|
|
22 6,
|
|
23 image,
|
|
24 &LoadedImageProtocol,
|
|
25 (void **)&loadedImage,
|
|
26 image,
|
|
27 NULL,
|
|
28 EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
|
|
29
|
|
30 if (EFI_ERROR(status)) {
|
|
31 Print(L"OpenProtocol is %r\n", status);
|
|
32 }
|
|
33
|
|
34 Print(L"Close Protocol\n");
|
|
35 status = uefi_call_wrapper(
|
|
36 BS->CloseProtocol,
|
|
37 4,
|
|
38 image,
|
|
39 &LoadedImageProtocol,
|
|
40 image,
|
|
41 NULL);
|
|
42
|
|
43 if (EFI_ERROR(status)) {
|
|
44 Print(L"CloseProtocol is %r\n", status);
|
|
45 }
|
|
46
|
0
|
47
|
|
48 return EFI_SUCCESS;
|
|
49 }
|