static EFI_SYSTEM_TABLE *systab;
static EFI_HANDLE global_image_handle;
-static EFI_STATUS (EFIAPI *entry_point) (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table);
static CHAR16 *second_stage;
static void *load_options;
* Once the image has been loaded it needs to be validated and relocated
*/
static EFI_STATUS handle_image (void *data, unsigned int datasize,
- EFI_LOADED_IMAGE *li)
+ EFI_LOADED_IMAGE *li,
+ EFI_IMAGE_ENTRY_POINT *entry_point)
{
EFI_STATUS efi_status;
char *buffer;
CopyMem(buffer, data, context.SizeOfHeaders);
- entry_point = ImageAddress(buffer, context.ImageSize, context.EntryPoint);
- if (!entry_point) {
+ *entry_point = ImageAddress(buffer, context.ImageSize, context.EntryPoint);
+ if (!*entry_point) {
perror(L"Entry point is invalid\n");
gBS->FreePages(alloc_address, alloc_size / PAGE_SIZE);
return EFI_UNSUPPORTED;
{
EFI_STATUS efi_status;
EFI_LOADED_IMAGE *li, li_bak;
+ EFI_IMAGE_ENTRY_POINT entry_point;
CHAR16 *PathName = NULL;
void *sourcebuffer = NULL;
UINT64 sourcesize = 0;
/*
* Verify and, if appropriate, relocate and execute the executable
*/
- efi_status = handle_image(data, datasize, li);
+ efi_status = handle_image(data, datasize, li, &entry_point);
if (EFI_ERROR(efi_status)) {
perror(L"Failed to load image: %r\n", efi_status);
PrintErrors();