Subversion Repositories HelenOS

Rev

Rev 2726 | Details | Compare with Previous | Last modification | View Log | RSS feed

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