-
Notifications
You must be signed in to change notification settings - Fork 11
/
t3.c
95 lines (75 loc) · 2.51 KB
/
t3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main(
EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *systab
)
{
EFI_GUID loaded_image_protocol = LOADED_IMAGE_PROTOCOL;
EFI_STATUS efi_status;
EFI_LOADED_IMAGE *li;
UINTN pat = PoolAllocationType;
VOID *void_li_p;
InitializeLib(image_handle, systab);
PoolAllocationType = 2; /* klooj */
Print(u"Hello World! (0xd=0x%x, 13=%d)\n", 13, 13);
Print(u"before InitializeLib(): PoolAllocationType=%d\n",
pat);
Print(u" after InitializeLib(): PoolAllocationType=%d\n",
PoolAllocationType);
/*
* Locate loaded_image_handle instance.
*/
Print(u"BS->HandleProtocol() ");
efi_status = uefi_call_wrapper(
BS->HandleProtocol,
3,
image_handle,
&loaded_image_protocol,
&void_li_p);
li = void_li_p;
Print(u"%xh (%r)\n", efi_status, efi_status);
if (efi_status != EFI_SUCCESS) {
return efi_status;
}
Print(u" li: %xh\n", li);
if (!li) {
return EFI_UNSUPPORTED;
}
Print(u" li->Revision: %xh\n", li->Revision);
Print(u" li->ParentHandle: %xh\n", li->ParentHandle);
Print(u" li->SystemTable: %xh\n", li->SystemTable);
Print(u" li->DeviceHandle: %xh\n", li->DeviceHandle);
Print(u" li->FilePath: %xh\n", li->FilePath);
Print(u" li->Reserved: %xh\n", li->Reserved);
Print(u" li->LoadOptionsSize: %xh\n", li->LoadOptionsSize);
Print(u" li->LoadOptions: %xh\n", li->LoadOptions);
Print(u" li->ImageBase: %xh\n", li->ImageBase);
Print(u" li->ImageSize: %xh\n", li->ImageSize);
Print(u" li->ImageCodeType: %xh\n", li->ImageCodeType);
Print(u" li->ImageDataType: %xh\n", li->ImageDataType);
Print(u" li->Unload: %xh\n", li->Unload);
#if 0
typedef struct {
UINT32 Revision;
EFI_HANDLE ParentHandle;
struct _EFI_SYSTEM_TABLE *SystemTable;
// Source location of image
EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH *FilePath;
VOID *Reserved;
// Images load options
UINT32 LoadOptionsSize;
VOID *LoadOptions;
// Location of where image was loaded
VOID *ImageBase;
UINT64 ImageSize;
EFI_MEMORY_TYPE ImageCodeType;
EFI_MEMORY_TYPE ImageDataType;
// If the driver image supports a dynamic unload request
EFI_IMAGE_UNLOAD Unload;
} EFI_LOADED_IMAGE;
#endif
return EFI_SUCCESS;
}