|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] efi: Reallocate memory map if ExitBootServices() fails
>>> On 29.05.15 at 09:48, <ross.lagerwall@xxxxxxxxxx> wrote:
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -1053,14 +1053,14 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE
> *SystemTable)
> efi_arch_video_init(gop, info_size, mode_info);
> }
>
> - efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
> - &efi_mdesc_size, &mdesc_ver);
> - efi_memmap = efi_arch_allocate_mmap_buffer(&efi_memmap_size);
> - if ( !efi_memmap )
> - blexit(L"Unable to allocate memory for EFI memory map");
> -
> for ( retry = 0; ; retry = 1 )
> {
> + efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
> + &efi_mdesc_size, &mdesc_ver);
> + efi_memmap = efi_arch_allocate_mmap_buffer(&efi_memmap_size);
> + if ( !efi_memmap )
> + blexit(L"Unable to allocate memory for EFI memory map");
You can't blexit() anymore after having called ExitBootServices() once.
Admittedly even the PrintErrMesg() used for "error handling" a few
lines down is on the edge of being invalid (but this is a best effort
thing anyway).
Further you should do a second allocation only if you positively
identified that the new size is larger than what the existing buffer
can hold. It may be worth allocating a couple of extra entries the
first time through anyway; perhaps that would even avoid th need
for this workaround.
Since, finally, this is only a workaround, as the spec clearly says:
"After an Operating System calls ExitBootServices(), firmware boot
services are no longer available and it is illegal to call any boot
service." Even our re-invocation of GetMemoryMap() is bending
that (and I only hesitantly agreed for it to be added).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |